Hi,
Pytorch is a complex library (maybe not the best one to learn basics)
I’m not developer and I don’t know the intrinsecs of pytorch.
In pytorch’s .pyi file you can find torch definitions. One of them is tensor. That is the stub file in which tensor usage is explained.
tensor itself It is defined here:
https://github.com/pytorch/pytorch/blob/7eb9f1788c2e865130db1875d07f5dbbd978e941/torch/init.py#L372
Until then tensor points to the torch/tensor.py file. Afterwards it points to some c++ defined function (maybe, I havent gone deeper).
Don’t get mad with pytorch. It’s complex.
If you want to follow the standard way of importing files look at the definition of Tensor instead of tensor.
It’s a python class you can easily inspect and it’s straight-forward imported.