vault dweller

Veni, Vidi, Coded.


PyTorch 03: Introduction to Tensors

Implementing tensors (finally!)

How about we create a tensor?

TENSOR = torch.tensor([[1, 2, 3
                        3, 6, 9
                        5, 4, 5]])
TENSOR
tensor([[[1, 2, 3],
         [3, 6, 9],
         [2, 4, 5]]])

That’s nice! Tensors can be used to represent almost anything.

What do you think ndim will give?

TENSOR.ndim
3

And, what about size()?

TENSOR.size()
torch.Size([1, 3, 3])