Skip to content

Conversation

@huzama
Copy link
Contributor

@huzama huzama commented Jul 4, 2024

This pull request aims to address an issue related to the randint function's maximum range, which is currently set 10. When this range is used on tensors with a bool dtype, it results in the following runtime error:

RuntimeError: to - 1 is out of bounds for bool 

By modifying the randint function's maximum range to 2, the code will be generalized and support tensors with bool dtype as well.

Changes Made

The following lines have been modified to set the randint maximum range to 2:

torch.randint(10, carried_input.size(),

Additional Notes

From my understanding of the code, the maximum value of 10 is set arbitrarily. If the number 10 holds specific significance, we might need to find an alternative way to address this issue.

Copy link
Collaborator

@ManfeiBai ManfeiBai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, @huzama, 10 was set arbitrarily, this PR LGTM, let's merge if CI is all green too

cc @JackCaoG

Copy link
Collaborator

@ManfeiBai ManfeiBai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks, let's merge after CI green

@qihqi qihqi merged commit 41d998d into pytorch:master Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

4 participants