What is the difference between Tensor and tensor? Is Tensor going to be deprecated in the future?

It looks like the torch.tensor is better than torch.Tensor when realize the same function?

I found a case to use Tensor rather than tensor:

torch.Tensor with int / float

In[] : 1/torch.Tensor([1,2,3])
Out[]: tensor([ 1.0000,  0.5000,  0.3333])

torch.tensor with int

In[] : 1/torch.tensor([1,2,3])
------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-231-55a86778a1f4> in <module>()
----> 1 1/torch.tensor([1,2,3]).
.../anaconda3/lib/python3.6/site-packages/torch/tensor.py in __rdiv__(self, other)
    318 
    319     def __rdiv__(self, other):
--> 320         return self.reciprocal() * other
    321     __rtruediv__ = __rdiv__
    322     __itruediv__ = _C._TensorBase.__idiv__

RuntimeError: reciprocal is not implemented for type torch.LongTensor

torch.tensor with float

In []: 1/torch.tensor([1.,2.,3.])
Out[]: tensor([ 1.0000,  0.5000,  0.3333])
1 Like