We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2d12eb2 commit 5feed1aCopy full SHA for 5feed1a
dpctl/tensor/_usmarray.pyx
@@ -257,7 +257,7 @@ cdef class usm_ndarray:
257
self.shape_ = shape_ptr
258
self.strides_ = strides_ptr
259
self.typenum_ = typenum
260
- self.flags_ = contig_flag
+ self.flags_ = (contig_flag | USM_ARRAY_WRITABLE)
261
self.nd_ = nd
262
self.array_namespace_ = array_namespace
263
@@ -952,6 +952,8 @@ cdef class usm_ndarray:
952
_copy_from_numpy_into,
953
_copy_from_usm_ndarray_to_usm_ndarray,
954
)
955
+ if (Xv.flags_ & USM_ARRAY_WRITABLE) == 0:
956
+ raise ValueError("Can not modify read-only array.")
957
if isinstance(val, usm_ndarray):
958
_copy_from_usm_ndarray_to_usm_ndarray(Xv, val)
959
else:
0 commit comments