Copy array to target Parameters ---------- target : NDArray The target array to be copied, must have same shape as this array.
(self, target)
| 344 | return np_arr |
| 345 | |
| 346 | def copyto(self, target): |
| 347 | """Copy array to target |
| 348 | |
| 349 | Parameters |
| 350 | ---------- |
| 351 | target : NDArray |
| 352 | The target array to be copied, must have same shape as this array. |
| 353 | """ |
| 354 | if isinstance(target, DGLContext): |
| 355 | target = empty(self.shape, self.dtype, target) |
| 356 | if isinstance(target, NDArrayBase): |
| 357 | check_call(_LIB.DGLArrayCopyFromTo(self.handle, target.handle)) |
| 358 | else: |
| 359 | raise ValueError("Unsupported target type %s" % str(type(target))) |
| 360 | return target |
| 361 | |
| 362 | def pin_memory_(self): |
| 363 | """Pin host memory and map into GPU address space (in-place)""" |