Skip to content

Commit

Permalink
Fixes mypy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
marksgraham committed Oct 17, 2023
1 parent 1d95d92 commit 355b4d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions monai/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,11 +890,11 @@ def is_sqrt(num: Sequence[int] | int) -> bool:
return ensure_tuple(ret) == num


def unsqueeze_right(arr: T, ndim: int) -> T:
def unsqueeze_right(arr: NdarrayOrTensor, ndim: int) -> NdarrayOrTensor:
"""Append 1-sized dimensions to `arr` to create a result with `ndim` dimensions."""
return arr[(...,) + (None,) * (ndim - arr.ndim)]


def unsqueeze_left(arr: T, ndim: int) -> T:
def unsqueeze_left(arr: NdarrayOrTensor, ndim: int) -> NdarrayOrTensor:
"""Prepend 1-sized dimensions to `arr` to create a result with `ndim` dimensions."""
return arr[(None,) * (ndim - arr.ndim)]

0 comments on commit 355b4d9

Please sign in to comment.