[ROCm] Retry loop implemented to avoid transient memory leak errors (#82607)
### Description
Added a retry loop to memory leak checker to avoid rare case in which ROCM reports a false positive memory leak.
### Issue
Original issue observed as part of this ticket: https://github.com/pytorch/pytorch/issues/62533
### Testing
- Applied changes and built
- python test/test_cuda.py
- Ensure all tests pass
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82607
Approved by: https://github.com/malfet