import torch
a = (torch.rand(3,4)*10).long()
print(a)
print(a*0.9)
Output:
tensor([[8, 5, 3, 4],
[1, 3, 6, 7],
[8, 5, 8, 8]])
tensor([[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]])
import torch
a = (torch.rand(3,4)*10).long()
print(a)
print(a*0.9)
Output:
tensor([[8, 5, 3, 4],
[1, 3, 6, 7],
[8, 5, 8, 8]])
tensor([[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]])
Hi,
I don’t think thats a bug, it tries to retain the type of the tensor as long hence the rounding of 0.9 to 0.