Issue
everyone, I have a small question.
What is the purpose of the method tensor.new(..)
in Pytorch, I didn't find anything in the documentation. It looks like it creates a new Tensor (like the name suggests), but why we don't just use torch.Tensor
constructors instead of using this new method that requires an existing tensor.
Thank you in advance.
Solution
As the documentation of tensor.new() says:
Constructs a new tensor of the same data type as self tensor.
Also note:
For CUDA tensors, this method will create new tensor on the same device as this tensor.
Answered By - Wasi Ahmad
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.