Skip to content

Commit

Permalink
Use Union type instead of Optional
Browse files Browse the repository at this point in the history
In Python, Optional[List[torch.Tensor]] and Union[None, list[torch.Tensor]] are actually equivalent types. This change is to help with pyupgrade automatic changes for py39-plus.

Signed-off-by: James Butler <[email protected]>
  • Loading branch information
jamesobutler committed Oct 23, 2024
1 parent a93e878 commit f7bc102
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion monai/networks/nets/dynunet.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DynUNetSkipLayer(nn.Module):
forward passes of the network.
"""

heads: Optional[List[torch.Tensor]]
heads: Union[None, List[torch.Tensor]]

def __init__(self, index, downsample, upsample, next_layer, heads=None, super_head=None):
super().__init__()
Expand Down

0 comments on commit f7bc102

Please sign in to comment.