Where is torch.tensor() actually defined?

so, I’m looking through the torch source code because I’m curious what exactly torch.tensor() does

it appears that it’s somewhere in /torch/_C.cpython-36m-x86_64-linux-gnu.so, which I’m assuming means it’s somewhere in pytorch/torch/csrc/, but I looked in the obvious places, and somehow wasn’t able to find where it was?

would appreciate if someone could point me to the implementation.

That’s a great question!
As I had written something about how the “regular” functions arrive in PyTorch, I added a bit on torch.tensor() at the bottom. It’s in section odds and ends in my selective tour through PyTorch internals.
If you have feedback, I’d be most happy to hear about it.

Best regards

Thomas

1 Like