Skip to content

Commit

Permalink
simplified
Browse files Browse the repository at this point in the history
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
  • Loading branch information
wyli committed Sep 28, 2021
1 parent 65053ea commit 9415e43
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 0 additions & 3 deletions monai/transforms/utility/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
from monai.utils import (
convert_data_type,
convert_to_cupy,
convert_to_dst_type,
convert_to_numpy,
convert_to_tensor,
ensure_tuple,
Expand Down Expand Up @@ -810,8 +809,6 @@ def __call__(
output_shape: expected shape of output indices. if None, use `self.output_shape` instead.
"""
if image is not None:
image, *_ = convert_to_dst_type(image, label, dtype=image.dtype)
if output_shape is None:
output_shape = self.output_shape
fg_indices, bg_indices = map_binary_to_indices(label, image, self.image_threshold)
Expand Down
4 changes: 2 additions & 2 deletions monai/transforms/utils_pytorch_numpy_unification.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ def unravel_index(idx, shape):
if isinstance(idx, torch.Tensor):
coord = []
for dim in reversed(shape):
coord.insert(0, idx % dim)
coord.append(idx % dim)
idx = floor_divide(idx, dim)
return torch.stack(coord)
return torch.stack(coord[::-1])
return np.unravel_index(np.asarray(idx, dtype=int), shape)


Expand Down

0 comments on commit 9415e43

Please sign in to comment.