Creates a clone of this tensor allocating a separate buffer for the data. If `device` is specified, the clone is placed on that device.
(self, device:str|tuple[str, ...]|None=None)
| 354 | return self._buffer().numpy().reshape(self.shape) |
| 355 | |
| 356 | def clone(self, device:str|tuple[str, ...]|None=None) -> Tensor: |
| 357 | """ |
| 358 | Creates a clone of this tensor allocating a separate buffer for the data. |
| 359 | If `device` is specified, the clone is placed on that device. |
| 360 | """ |
| 361 | ret = Tensor(self.uop.clone(device=device)) |
| 362 | if self.grad is not None: ret.grad = self.grad.clone(device=device) |
| 363 | return ret.is_param_(self.is_param) |
| 364 | |
| 365 | def to(self, device:str|tuple[str, ...]|None) -> Tensor: |
| 366 | """ |