Replaces the data of this tensor with the data of another tensor. Only the shape of the tensors must match.
(self, x:Tensor)
| 245 | return self |
| 246 | |
| 247 | def replace(self, x:Tensor) -> Tensor: |
| 248 | """ |
| 249 | Replaces the data of this tensor with the data of another tensor. Only the shape of the tensors must match. |
| 250 | """ |
| 251 | # used for replacing a Tensor with a new version of it (potentially with a different device and dtype) |
| 252 | assert self.shape == x.shape, f"replace shape mismatch {self.shape} != {x.shape}" |
| 253 | self.uop = x.uop |
| 254 | return self |
| 255 | |
| 256 | def assign(self, x:Tensor|PyConst|list|tuple) -> Tensor: |
| 257 | is_disk = isinstance(self.device, str) and self.device.startswith("DISK") |
no outgoing calls
no test coverage detected