Skip to content

Commit 6e18457

Browse files
committed
Allow writing to strides in python.
1 parent c9552a6 commit 6e18457

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

pygpu/gpuarray.pyx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1937,6 +1937,13 @@ cdef class GpuArray:
19371937
res[i] = self.ga.strides[i]
19381938
return tuple(res)
19391939

1940+
def __set__(self, newstrides):
1941+
cdef unsigned int i
1942+
if len(newstrides) != self.ga.nd:
1943+
raise ValueError("new strides are the wrong length")
1944+
for i in range(self.ga.nd):
1945+
self.ga.strides[i] = newstrides[i]
1946+
19401947
property ndim:
19411948
"The number of dimensions in this object"
19421949
def __get__(self):

0 commit comments

Comments
 (0)