Why are there some pytorch functions not listed in the documentation?

For instance, I can’t find Tensor.new in the documentation. I also tried

from torch import Tensor
print(Tensor.new.__doc__)

in my console, but no words appeared. Besides, I remember there are some other pytorch functions that are without documentation, but I can’t recall any name of them right now so I just take Tensor.new as an example.

Some methods are not properly documented as these are mainly used in internal code. E.g. the new() call returns a tensor in a new shape with uninitialized memory:

x = torch.tensor(1)
print(x)
# tensor(1)
y = x.new(2)
print(y)
# tensor([3616445622929465956, 6066685342842367284])

but also accepts a storage:

x.untyped_storage()
#  1
#  0
#  0
#  0
#  0
#  0
#  0
#  0
# [torch.storage.UntypedStorage(device=cpu) of size 8]

x.new(x.untyped_storage())
# tensor([1])

User code should explicitly call e.g. new_empty .

Thanks for your immediate reply! I am used to writing new_empty, but when I read other users’ codes with new, I may get confused since there’s no documentation.