torch.tensor

While browsing a project's code, I found a usage example of torch.Tensor([]). As far as I know, We can use a numpy array to initialize a torch tensor. So I went into the Pytorch official references.

The official docs say a tensor can be constructed with the Python list using a torch.tensor() constructor. I want to say, from my experiences, torch.Tensor() has the same effect. That is we can create a tensor with torch.Tensor() constructor. I don't know why there are two methods to achieve this goal.

Interesting things come here. If the given list is an empty list, does that mean the result tensor is an empty tensor.

We should not get confused with the torch.empty() function.