MCPcopy Index your code
hub / github.com/dmlc/dgl / __setitem__

Method __setitem__

python/dgl/_ffi/ndarray.py:255–269  ·  view source on GitHub ↗

Set ndarray value

(self, in_slice, value)

Source from the content-addressed store, hash-verified

253 return self.__hash__() == other.__hash__()
254
255 def __setitem__(self, in_slice, value):
256 """Set ndarray value"""
257 if (
258 not isinstance(in_slice, slice)
259 or in_slice.start is not None
260 or in_slice.stop is not None
261 ):
262 raise ValueError("Array only support set from numpy array")
263 if isinstance(value, NDArrayBase):
264 if value.handle is not self.handle:
265 value.copyto(self)
266 elif isinstance(value, (np.ndarray, np.generic)):
267 self.copyfrom(value)
268 else:
269 raise TypeError("type %s not supported" % str(type(value)))
270
271 def copyfrom(self, source_array):
272 """Perform a synchronized copy from the array.

Callers

nothing calls this directly

Calls 2

copyfromMethod · 0.95
copytoMethod · 0.80

Tested by

no test coverage detected