1

https://pytorch.org/docs/stable/tensors.html#torch.Tensor.T says Tensor.T

Returns a view of this tensor with its dimensions reversed.

I wonder if TORCH.TRANSPOSE is the same.


Update

Found this post helpful What does .contiguous() do in PyTorch?

dontloo
  • 10,067
  • 4
  • 29
  • 50

1 Answers1

2

It's actually mentioned in the doc:

If input is a strided tensor then the resulting out tensor shares its underlying storage with the input tensor, so changing the content of one would change the content of the other.

If input is a sparse tensor then the resulting out tensor does not share the underlying storage with the input tensor.

So, eseentially if the input is a strided tensor, the output would be a view; for a sparse tensor, it's copied.

heemayl
  • 39,294
  • 7
  • 70
  • 76