Skip to content

AttributeError: 'PerceptualLoss' object has no attribute 'channel_wise' #7692

@KumoLiu

Description

@KumoLiu
[2024-04-21T01:34:48.412Z] ======================================================================
[2024-04-21T01:34:48.412Z] ERROR: test_shape_10 (tests.test_perceptual_loss.TestPerceptualLoss)
[2024-04-21T01:34:48.412Z] ----------------------------------------------------------------------
[2024-04-21T01:34:48.412Z] Traceback (most recent call last):
[2024-04-21T01:34:48.412Z]   File "/usr/local/lib/python3.10/dist-packages/parameterized/parameterized.py", line 620, in standalone_func
[2024-04-21T01:34:48.412Z]     return func(*(a + p.args), **p.kwargs, **kw)
[2024-04-21T01:34:48.412Z]   File "/opt/monai/tests/test_perceptual_loss.py", line 85, in test_shape
[2024-04-21T01:34:48.412Z]     result = loss(torch.randn(input_shape), torch.randn(target_shape))
[2024-04-21T01:34:48.412Z]   File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
[2024-04-21T01:34:48.412Z]     return self._call_impl(*args, **kwargs)
[2024-04-21T01:34:48.412Z]   File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1520, in _call_impl
[2024-04-21T01:34:48.412Z]     return forward_call(*args, **kwargs)
[2024-04-21T01:34:48.412Z]   File "/opt/monai/monai/losses/perceptual.py", line 184, in forward
[2024-04-21T01:34:48.412Z]     if self.channel_wise:
[2024-04-21T01:34:48.412Z]   File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1688, in __getattr__
[2024-04-21T01:34:48.412Z]     raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
[2024-04-21T01:34:48.412Z] AttributeError: 'PerceptualLoss' object has no attribute 'channel_wise'
[2024-04-21T01:34:48.412Z] 

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions