File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -115,12 +115,18 @@ def flags(self):
115
115
116
116
# check if F contiguous
117
117
from itertools import accumulate
118
- f_strides = tuple (accumulate (list (self ._tensor .shape ), func = lambda x , y : x * y ))
118
+
119
+ f_strides = tuple (accumulate (list (self ._tensor .shape ), func = lambda x , y : x * y ))
119
120
f_strides = (1 ,) + f_strides [:- 1 ]
120
121
is_f_contiguous = f_strides == self ._tensor .stride ()
121
122
122
- return Flags ({"C_CONTIGUOUS" : self ._tensor .is_contiguous (),
123
- "F_CONTIGUOUS" : is_f_contiguous ,}
123
+ return Flags (
124
+ {
125
+ "C_CONTIGUOUS" : self ._tensor .is_contiguous (),
126
+ "F_CONTIGUOUS" : is_f_contiguous ,
127
+ "OWNDATA" : self ._tensor ._base is None ,
128
+ "WRITEABLE" : True , # pytorch does not have readonly tensors
129
+ }
124
130
)
125
131
126
132
@property
You can’t perform that action at this time.
0 commit comments