My question is the title, in Pytorch’s document, as I understand, the performance of torch.tensor() and torch.Tensor() is similar.
However, when I train my model, my data was read by torch.tensor() and the performance was very poor, but when I switch to torch.Tensor(), the model predicts correctly what I want.
I just change torch.tensor() to torch.Tensor(), I am training a regression model and no matter what architecture I used, after a short time of training, all the output will tend to be similar. (at first, I think it is the batch norm problem)
Then I decided to create a new project and code again, this time when I use torch.Tensor(my_target), I got something like this
torch.Tensor(10) will return an uninitialized FloatTensor with 10 values, while torch.tensor(10) will return a LongTensor containing a single value (10).
I would recommend to use the second approach (lowercase t) or any other factory method instead of creating uninitialized tensors via torch.Tensor or torch.FloatTensor.
To explicitly create a tensor with uninitialized memory, you could still use torch.empty.