Set ndarray value
(self, in_slice, value)
| 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. |