SoFunction
Updated on 2024-11-21

pytorch Getting tensor dimension information example

I'll cut to the chase and get right to the code!

>>> import torch
>>> from  import Variable
>>> from torch import IntTensor
>>> var = Variable(IntTensor([[1,0],[0,1]]))
 
>>> var
Variable containing:
 1 0
 0 1
[ of size 2x2]
 
>>> ()
([2, 2])
 
>>> list(())
[2, 2]

consultation/questions/46826218/pytorch-how-to-get-the-shape-of-a-tensor-as-a-list-of-int

Above this pytorch get tensor dimension information example is all I have shared with you, I hope it can give you a reference, and I hope you can support me more.