Skip to content

Commit a003564

Browse files
committed
ENH: writeable and owndata flags
1 parent 5f423d2 commit a003564

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

torch_np/_ndarray.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ def flags(self):
120120
is_f_contiguous = f_strides == self._tensor.stride()
121121

122122
return Flags({"C_CONTIGUOUS": self._tensor.is_contiguous(),
123-
"F_CONTIGUOUS": is_f_contiguous,}
123+
"F_CONTIGUOUS": is_f_contiguous,
124+
"OWNDATA": self._tensor._base is None,
125+
"WRITEABLE": True, # pytorch does not have readonly tensors
126+
}
124127
)
125128

126129
@property

0 commit comments

Comments
 (0)