Describe the bug
The function torch.utils.checkpoint.checkpoint doesn't have a use_reentrant argument in Pytorch<=1.10. This function is used with this argument in SwinUNETR but tests don't cover the case where using checkpointing is enabled. The tests should be enhanced to account for this, or we drop support for older versions of Pytorch. This is related to an issue in PR #7260.
To Reproduce
Steps to reproduce the behavior:
- Create an instance of
SwinUNETR with use_checkpoint=True and attempt a forward pass using an older version of Pytorch.
Expected behavior
Forward pass should work as normal.
Environment
Pytorch<=1.10.