`torch.Tensor(2)`

returns `tensor([-4.9389e+23, 4.5758e-41])`

, while `torch.tensor(2)`

returns `tensor(2)`

. I coud’t find the manual for torch.Tensor, and it’s very confusing of these two object constructor. What’s the reason to define ‘torch.Tensor’ when ‘torch.tensor’ is already defined?

`torch.Tensor`

uses uninitialized memory, so you shouldn’t use it.

`torch.tensor`

creates a new tensor using the passed values.

I found the usage in `torch.nn.batchnorm`

`self.weight = Parameter(torch.Tensor(num_features))`

So `torch.Tensor`

is not recommended?

Yes, don’t use it.

`nn.BatchNorm`

calls `reset_parameters()`

afterwards, which will initialize these tensors.

Ok, thanks for the reply!