I have a use case where I need to know the shapes of each torch.Tensor, I have a custom hack for pytorch in python:
import torch
torch_available = True
def torch_custom_repr(self):
return f">>> {tuple(self.shape)}\n{torch_original_repr(self)}\non <{self.device}>\n<<< {tuple(self.shape)}"
torch_original_repr = torch.Tensor.__repr__
torch.Tensor.__repr__ = torch_custom_repr
Now it looks like this in debug mode:
Is it possible to make it shorter like this:

I have a use case where I need to know the shapes of each torch.Tensor, I have a custom hack for
pytorchinpython:Now it looks like this in debug mode:
Is it possible to make it shorter like this: