2024-03-06 17:08:20 +08:00
|
|
|
# PyorchHack
|
|
|
|
|
|
|
|
python3.10/site-packages/torch/_tensor.py
|
|
|
|
|
|
|
|
```
|
|
|
|
def __repr__(self, *, tensor_contents=None):
|
2024-03-06 19:39:56 +08:00
|
|
|
return "Tensor " + str(self.size()) + " " + self.device.type + " " + str(self.dtype)
|
2024-03-06 17:08:20 +08:00
|
|
|
if has_torch_function_unary(self):
|
|
|
|
return handle_torch_function(
|
|
|
|
Tensor.__repr__, (self,), self, tensor_contents=tensor_contents
|
|
|
|
)
|
|
|
|
# All strings are unicode in Python 3.
|
|
|
|
return torch._tensor_str._str(self, tensor_contents=tensor_contents)
|
|
|
|
```
|