Skip to content
Discussion options

You must be logged in to vote

You need to change torch.dtype() when using torch.arange() since in the deprecated (old version) of Torch, when using torch.range(), the values were float32 by default. Now, for torch.arange(), its dtype is Long by default.

So, looking at your RuntimeError: "check_uniform_bounds" not implemented for 'Long' error, one_ten generated by torch.arange() yields Long values, but torch.rand_like only accepts float values. To debug this, simply change the dtype.

one_ten= torch.arange(1, 10).to(torch.float32)
ten_rand= torch.rand_like(input=one_ten) 
ten_rand

You can also do print(one_ten) on both range and arange to know the difference and check their dtypes.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Rohi2610
Comment options

Answer selected by Rohi2610
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants