There is no warning or error when I tried to cast an ‘int’ to tensor, though it is not correct, there is no warning there and may cause “trouble”.
torch.Tensor(8)
Out[9]:
tensor([8.9326e+36, 4.5598e-41, 6.1690e-30, 3.0837e-41, 3.3631e-44, 0.0000e+00,
7.3986e+31, 4.5559e-41])
torch.Tensor(8.0)
Traceback (most recent call last):
File "/home/lii/Programs/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2961, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-10-bdc841c73802>", line 1, in <module>
torch.Tensor(8.0)
TypeError: new(): data must be a sequence (got float)