Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

torch 1.9 compatibility test_surface_distance #7088

Closed
wyli opened this issue Oct 5, 2023 · 0 comments · Fixed by #7080
Closed

torch 1.9 compatibility test_surface_distance #7088

wyli opened this issue Oct 5, 2023 · 0 comments · Fixed by #7080

Comments

@wyli
Copy link
Contributor

wyli commented Oct 5, 2023

[2023-10-05T00:02:00.061Z] ======================================================================
[2023-10-05T00:02:00.061Z] ERROR: test_not_predicted_not_present (tests.test_surface_dice.TestAllSurfaceDiceMetrics)
[2023-10-05T00:02:00.061Z] ----------------------------------------------------------------------
[2023-10-05T00:02:00.061Z] Traceback (most recent call last):
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/tests/test_surface_dice.py", line 366, in test_not_predicted_not_present
[2023-10-05T00:02:00.061Z]     res_bgr_classes = sur_metric_bgr(predictions_hot, labels_hot)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 344, in __call__
[2023-10-05T00:02:00.061Z]     ret = super().__call__(y_pred=y_pred, y=y, **kwargs)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 77, in __call__
[2023-10-05T00:02:00.061Z]     return self._compute_tensor(y_pred.detach(), y_, **kwargs)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/surface_dice.py", line 103, in _compute_tensor
[2023-10-05T00:02:00.061Z]     return compute_surface_dice(
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/surface_dice.py", line 278, in compute_surface_dice
[2023-10-05T00:02:00.061Z]     nsd[b, c] = torch.nan
[2023-10-05T00:02:00.061Z] AttributeError: module 'torch' has no attribute 'nan'
[2023-10-05T00:02:00.061Z] 
[2023-10-05T00:02:00.061Z] ======================================================================
[2023-10-05T00:02:00.061Z] ERROR: test_tolerance_euclidean_distance (tests.test_surface_dice.TestAllSurfaceDiceMetrics)
[2023-10-05T00:02:00.061Z] ----------------------------------------------------------------------
[2023-10-05T00:02:00.061Z] Traceback (most recent call last):
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/tests/test_surface_dice.py", line 99, in test_tolerance_euclidean_distance
[2023-10-05T00:02:00.061Z]     res0 = sd0(predictions_hot, labels_hot)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 344, in __call__
[2023-10-05T00:02:00.061Z]     ret = super().__call__(y_pred=y_pred, y=y, **kwargs)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 77, in __call__
[2023-10-05T00:02:00.061Z]     return self._compute_tensor(y_pred.detach(), y_, **kwargs)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/surface_dice.py", line 103, in _compute_tensor
[2023-10-05T00:02:00.061Z]     return compute_surface_dice(
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/surface_dice.py", line 278, in compute_surface_dice
[2023-10-05T00:02:00.061Z]     nsd[b, c] = torch.nan
[2023-10-05T00:02:00.061Z] AttributeError: module 'torch' has no attribute 'nan'
[2023-10-05T00:02:00.061Z] 
[2023-10-05T00:02:00.061Z] ======================================================================
[2023-10-05T00:02:00.061Z] ERROR: test_tolerance_euclidean_distance_3d (tests.test_surface_dice.TestAllSurfaceDiceMetrics)
[2023-10-05T00:02:00.061Z] ----------------------------------------------------------------------
[2023-10-05T00:02:00.061Z] Traceback (most recent call last):
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/tests/test_surface_dice.py", line 143, in test_tolerance_euclidean_distance_3d
[2023-10-05T00:02:00.061Z]     res0 = sd0(predictions_hot, labels_hot)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 344, in __call__
[2023-10-05T00:02:00.061Z]     ret = super().__call__(y_pred=y_pred, y=y, **kwargs)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 77, in __call__
[2023-10-05T00:02:00.061Z]     return self._compute_tensor(y_pred.detach(), y_, **kwargs)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/surface_dice.py", line 103, in _compute_tensor
[2023-10-05T00:02:00.061Z]     return compute_surface_dice(
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/surface_dice.py", line 278, in compute_surface_dice
[2023-10-05T00:02:00.061Z]     nsd[b, c] = torch.nan
[2023-10-05T00:02:00.061Z] AttributeError: module 'torch' has no attribute 'nan'
[2023-10-05T00:02:00.061Z] 
[2023-10-05T00:02:00.061Z] ======================================================================
[2023-10-05T00:02:00.061Z] ERROR: test_tolerance_euclidean_distance_with_spacing (tests.test_surface_dice.TestAllSurfaceDiceMetrics)
[2023-10-05T00:02:00.061Z] ----------------------------------------------------------------------
[2023-10-05T00:02:00.061Z] Traceback (most recent call last):
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/tests/test_surface_dice.py", line 39, in test_tolerance_euclidean_distance_with_spacing
[2023-10-05T00:02:00.061Z]     res0 = sd0(predictions_hot, labels_hot, spacing=test_spacing)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 344, in __call__
[2023-10-05T00:02:00.061Z]     ret = super().__call__(y_pred=y_pred, y=y, **kwargs)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 77, in __call__
[2023-10-05T00:02:00.061Z]     return self._compute_tensor(y_pred.detach(), y_, **kwargs)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/surface_dice.py", line 103, in _compute_tensor
[2023-10-05T00:02:00.061Z]     return compute_surface_dice(
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/surface_dice.py", line 278, in compute_surface_dice
[2023-10-05T00:02:00.061Z]     nsd[b, c] = torch.nan
[2023-10-05T00:02:00.061Z] AttributeError: module 'torch' has no attribute 'nan'
[2023-10-05T00:02:00.061Z] 
[2023-10-05T00:02:00.061Z] ======================================================================
[2023-10-05T00:02:00.061Z] ERROR: test_nans_0 (tests.test_hausdorff_distance.TestHausdorffDistance)
[2023-10-05T00:02:00.061Z] ----------------------------------------------------------------------
[2023-10-05T00:02:00.061Z] Traceback (most recent call last):
[2023-10-05T00:02:00.061Z]   File "/opt/conda/lib/python3.8/site-packages/parameterized/parameterized.py", line 620, in standalone_func
[2023-10-05T00:02:00.061Z]     return func(*(a + p.args), **p.kwargs, **kw)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/tests/test_hausdorff_distance.py", line 201, in test_nans
[2023-10-05T00:02:00.061Z]     hd_metric(batch_seg_1, batch_seg_2, spacing=spacing)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 344, in __call__
[2023-10-05T00:02:00.061Z]     ret = super().__call__(y_pred=y_pred, y=y, **kwargs)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 77, in __call__
[2023-10-05T00:02:00.061Z]     return self._compute_tensor(y_pred.detach(), y_, **kwargs)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/hausdorff_distance.py", line 107, in _compute_tensor
[2023-10-05T00:02:00.061Z]     return compute_hausdorff_distance(
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/hausdorff_distance.py", line 196, in compute_hausdorff_distance
[2023-10-05T00:02:00.061Z]     percentile_distances = [_compute_percentile_hausdorff_distance(d, percentile) for d in distances]
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/hausdorff_distance.py", line 196, in <listcomp>
[2023-10-05T00:02:00.061Z]     percentile_distances = [_compute_percentile_hausdorff_distance(d, percentile) for d in distances]
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/hausdorff_distance.py", line 211, in _compute_percentile_hausdorff_distance
[2023-10-05T00:02:00.061Z]     return torch.tensor(torch.nan, dtype=torch.float, device=surface_distance.device)
[2023-10-05T00:02:00.061Z] AttributeError: module 'torch' has no attribute 'nan'
[2023-10-05T00:02:00.061Z] 
[2023-10-05T00:02:00.061Z] ======================================================================
[2023-10-05T00:02:00.061Z] ERROR: test_nans_1 (tests.test_hausdorff_distance.TestHausdorffDistance)
[2023-10-05T00:02:00.061Z] ----------------------------------------------------------------------
[2023-10-05T00:02:00.061Z] Traceback (most recent call last):
[2023-10-05T00:02:00.061Z]   File "/opt/conda/lib/python3.8/site-packages/parameterized/parameterized.py", line 620, in standalone_func
[2023-10-05T00:02:00.061Z]     return func(*(a + p.args), **p.kwargs, **kw)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/tests/test_hausdorff_distance.py", line 201, in test_nans
[2023-10-05T00:02:00.061Z]     hd_metric(batch_seg_1, batch_seg_2, spacing=spacing)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 344, in __call__
[2023-10-05T00:02:00.061Z]     ret = super().__call__(y_pred=y_pred, y=y, **kwargs)
[2023-10-05T00:02:00.061Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 77, in __call__
[2023-10-05T00:02:00.062Z]     return self._compute_tensor(y_pred.detach(), y_, **kwargs)
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/hausdorff_distance.py", line 107, in _compute_tensor
[2023-10-05T00:02:00.062Z]     return compute_hausdorff_distance(
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/hausdorff_distance.py", line 196, in compute_hausdorff_distance
[2023-10-05T00:02:00.062Z]     percentile_distances = [_compute_percentile_hausdorff_distance(d, percentile) for d in distances]
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/hausdorff_distance.py", line 196, in <listcomp>
[2023-10-05T00:02:00.062Z]     percentile_distances = [_compute_percentile_hausdorff_distance(d, percentile) for d in distances]
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/hausdorff_distance.py", line 211, in _compute_percentile_hausdorff_distance
[2023-10-05T00:02:00.062Z]     return torch.tensor(torch.nan, dtype=torch.float, device=surface_distance.device)
[2023-10-05T00:02:00.062Z] AttributeError: module 'torch' has no attribute 'nan'
[2023-10-05T00:02:00.062Z] 
[2023-10-05T00:02:00.062Z] ======================================================================
[2023-10-05T00:02:00.062Z] ERROR: test_compute (tests.test_handler_hausdorff_distance.TestHandlerHausdorffDistance)
[2023-10-05T00:02:00.062Z] ----------------------------------------------------------------------
[2023-10-05T00:02:00.062Z] Traceback (most recent call last):
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/tests/test_handler_hausdorff_distance.py", line 84, in test_compute
[2023-10-05T00:02:00.062Z]     hd_metric.update([y_pred, y])
[2023-10-05T00:02:00.062Z]   File "/opt/conda/lib/python3.8/site-packages/ignite/metrics/metric.py", line 607, in wrapper
[2023-10-05T00:02:00.062Z]     func(self, *args, **kwargs)
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/handlers/ignite_metric.py", line 112, in update
[2023-10-05T00:02:00.062Z]     self.metric_fn(y_pred, y)
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 344, in __call__
[2023-10-05T00:02:00.062Z]     ret = super().__call__(y_pred=y_pred, y=y, **kwargs)
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 77, in __call__
[2023-10-05T00:02:00.062Z]     return self._compute_tensor(y_pred.detach(), y_, **kwargs)
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/hausdorff_distance.py", line 107, in _compute_tensor
[2023-10-05T00:02:00.062Z]     return compute_hausdorff_distance(
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/hausdorff_distance.py", line 196, in compute_hausdorff_distance
[2023-10-05T00:02:00.062Z]     percentile_distances = [_compute_percentile_hausdorff_distance(d, percentile) for d in distances]
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/hausdorff_distance.py", line 196, in <listcomp>
[2023-10-05T00:02:00.062Z]     percentile_distances = [_compute_percentile_hausdorff_distance(d, percentile) for d in distances]
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/hausdorff_distance.py", line 211, in _compute_percentile_hausdorff_distance
[2023-10-05T00:02:00.062Z]     return torch.tensor(torch.nan, dtype=torch.float, device=surface_distance.device)
[2023-10-05T00:02:00.062Z] AttributeError: module 'torch' has no attribute 'nan'
[2023-10-05T00:02:00.062Z] 
[2023-10-05T00:02:00.062Z] ======================================================================
[2023-10-05T00:02:00.062Z] ERROR: test_compute (tests.test_handler_surface_distance.TestHandlerSurfaceDistance)
[2023-10-05T00:02:00.062Z] ----------------------------------------------------------------------
[2023-10-05T00:02:00.062Z] Traceback (most recent call last):
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/tests/test_handler_surface_distance.py", line 84, in test_compute
[2023-10-05T00:02:00.062Z]     sur_metric.update([y_pred, y])
[2023-10-05T00:02:00.062Z]   File "/opt/conda/lib/python3.8/site-packages/ignite/metrics/metric.py", line 607, in wrapper
[2023-10-05T00:02:00.062Z]     func(self, *args, **kwargs)
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/handlers/ignite_metric.py", line 112, in update
[2023-10-05T00:02:00.062Z]     self.metric_fn(y_pred, y)
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 344, in __call__
[2023-10-05T00:02:00.062Z]     ret = super().__call__(y_pred=y_pred, y=y, **kwargs)
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 77, in __call__
[2023-10-05T00:02:00.062Z]     return self._compute_tensor(y_pred.detach(), y_, **kwargs)
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/surface_distance.py", line 93, in _compute_tensor
[2023-10-05T00:02:00.062Z]     return compute_average_surface_distance(
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/surface_distance.py", line 184, in compute_average_surface_distance
[2023-10-05T00:02:00.062Z]     asd[b, c] = torch.nan if surface_distance.shape == (0,) else surface_distance.mean()
[2023-10-05T00:02:00.062Z] AttributeError: module 'torch' has no attribute 'nan'
[2023-10-05T00:02:00.062Z] 
[2023-10-05T00:02:00.062Z] ======================================================================
[2023-10-05T00:02:00.062Z] ERROR: test_nans_0 (tests.test_surface_distance.TestAllSurfaceMetrics)
[2023-10-05T00:02:00.062Z] ----------------------------------------------------------------------
[2023-10-05T00:02:00.062Z] Traceback (most recent call last):
[2023-10-05T00:02:00.062Z]   File "/opt/conda/lib/python3.8/site-packages/parameterized/parameterized.py", line 620, in standalone_func
[2023-10-05T00:02:00.062Z]     return func(*(a + p.args), **p.kwargs, **kw)
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/tests/test_surface_distance.py", line 178, in test_nans
[2023-10-05T00:02:00.062Z]     sur_metric(batch_seg_1, batch_seg_2, spacing=spacing)
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 344, in __call__
[2023-10-05T00:02:00.062Z]     ret = super().__call__(y_pred=y_pred, y=y, **kwargs)
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 73, in __call__
[2023-10-05T00:02:00.062Z]     return self._compute_list(y_pred, y, **kwargs)
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 97, in _compute_list
[2023-10-05T00:02:00.062Z]     ret = [
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/metric.py", line 98, in <listcomp>
[2023-10-05T00:02:00.062Z]     self._compute_tensor(p.detach().unsqueeze(0), y_.detach().unsqueeze(0), **kwargs)
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/surface_distance.py", line 93, in _compute_tensor
[2023-10-05T00:02:00.062Z]     return compute_average_surface_distance(
[2023-10-05T00:02:00.062Z]   File "/home/jenkins/agent/workspace/Monai-pytorch-versions/monai/metrics/surface_distance.py", line 184, in compute_average_surface_distance
[2023-10-05T00:02:00.062Z]     asd[b, c] = torch.nan if surface_distance.shape == (0,) else surface_distance.mean()
[2023-10-05T00:02:00.062Z] AttributeError: module 'torch' has no attribute 'nan'
[2023-10-05T00:02:00.062Z] 
[2023-10-05T00:02:00.062Z] ======================================================================
[2023-10-05T00:02:00.062Z] ERROR: test_nans_1 (tests.test_surface_distance.TestAllSurfaceMetrics)
[2023-10-05T00:02:00.062Z] ----------------------------------------------------------------------
[2023-10-05T00:02:00.062Z] 
wyli added a commit to wyli/MONAI that referenced this issue Oct 5, 2023
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
@wyli wyli closed this as completed in #7080 Oct 5, 2023
wyli added a commit that referenced this issue Oct 5, 2023
Fixes #7088


### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant