-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You need to change So, looking at your one_ten= torch.arange(1, 10).to(torch.float32)
ten_rand= torch.rand_like(input=one_ten)
ten_rand You can also do |
Beta Was this translation helpful? Give feedback.
You need to change
torch.dtype()
when usingtorch.arange()
since in the deprecated (old version) of Torch, when usingtorch.range()
, the values were float32 by default. Now, fortorch.arange()
, its dtype is Long by default.So, looking at your
RuntimeError: "check_uniform_bounds" not implemented for 'Long'
error,one_ten
generated bytorch.arange()
yields Long values, buttorch.rand_like
only accepts float values. To debug this, simply change the dtype.You can also do
print(one_ten)
on bothrange
andarange
to know the difference and check their dtypes.