Replies: 3 comments
-
Hi @VijayV28, That's an excellent question I don't have the answer to. I'd like to know too. Perhaps asking in the PyTorch forums could help? |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for your response. Will try your suggestion 👍 |
Beta Was this translation helpful? Give feedback.
-
The torch.rand_like() is specifically designed to sample from a continuous uniform distribution between 0 and 1. The numbers it generates are floating-point values (e.g., 0.112, 0.875, 0.999). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey,
I was trying to implement the torch.rand_like() on an array generated by torch.arange() and got an error:
Array:
Random function:
This threw an error as shown below:
RuntimeError: "check_uniform_bounds" not implemented for 'Long'
However, I later discovered that the
dtype
of the tensor generated by the torch.arange function isint64
.The rand_like() works well once I change the
dtype
back tofloat32
:I'd really like to know why doesn't rand_like() support
int64
datatype while the othertensor_like()
functions do.Beta Was this translation helpful? Give feedback.
All reactions