Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Use correct generator in __iter__ method Ensure the local gener… (…
…#4078) Fix: Use correct generator in __iter__ method Ensure the local generator is used in the random number generation process to maintain reproducibility. ## Summary This commit fixes an issue in the `__iter__` method where the wrong generator was being used in the random number generation process. The local `generator` variable, which is correctly initialized based on the condition, should be used instead of `self.generator`. ## Changes - Updated the `torch.randint` call to use the local `generator` variable. - Ensured that the random number generation process is consistent and reproducible. ## Impact This change ensures that the random number generation process is correctly controlled by the local `generator`, which is crucial for maintaining the reproducibility of experiments and results. ## Testing - Added unit tests to verify that the `__iter__` method generates the expected indices. - Ran existing tests to ensure no regressions were introduced.
- Loading branch information