Skip to content

Commit 515c659

Browse files
author
Fabio Ferreira
committed
feat: add activation checkpointing to down and up paths to be more efficient
1 parent 4c4782e commit 515c659

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

monai/networks/nets/unet.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,8 @@ def forward(self, x: torch.Tensor) -> torch.Tensor:
314314
class CheckpointUNet(UNet):
315315
def _get_connection_block(self, down_path: nn.Module, up_path: nn.Module, subblock: nn.Module) -> nn.Module:
316316
subblock = _ActivationCheckpointWrapper(subblock)
317+
down_path = _ActivationCheckpointWrapper(down_path)
318+
up_path = _ActivationCheckpointWrapper(up_path)
317319
return super()._get_connection_block(down_path, up_path, subblock)
318320

319321

0 commit comments

Comments
 (0)