Returns a copy of the MetaTensor instance. Args: kwargs: additional keyword arguments to `torch.clone`. See also: https://pytorch.org/docs/stable/generated/torch.clone.html
(self, **kwargs)
| 518 | ) |
| 519 | |
| 520 | def clone(self, **kwargs): |
| 521 | """ |
| 522 | Returns a copy of the MetaTensor instance. |
| 523 | |
| 524 | Args: |
| 525 | kwargs: additional keyword arguments to `torch.clone`. |
| 526 | |
| 527 | See also: https://pytorch.org/docs/stable/generated/torch.clone.html |
| 528 | """ |
| 529 | new_inst = MetaTensor(self.as_tensor().clone(**kwargs)) |
| 530 | new_inst.__dict__ = deepcopy(self.__dict__) |
| 531 | return new_inst |
| 532 | |
| 533 | @staticmethod |
| 534 | def ensure_torch_and_prune_meta( |