[Fori_loop] Update randint max range to Support bool dtype #7632
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
This pull request aims to address an issue related to the
randintfunction's maximum range, which is currently set 10. When this range is used on tensors with abooldtype, it results in the following runtime error:By modifying the
randintfunction's maximum range to 2, the code will be generalized and support tensors withbooldtype as well.Changes Made
The following lines have been modified to set the
randintmaximum range to 2:xla/torch_xla/experimental/fori_loop.py
Line 76 in 10a5130
xla/torch_xla/experimental/fori_loop.py
Line 84 in 10a5130
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.