Skip to content

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

Closed

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] 

Activity

  1. self-assigned this
    on Apr 22, 2024
  2. added a commit that references this issue on Apr 22, 2024
    9a229ab
  3. added a commit that references this issue on Apr 22, 2024
    178ebc8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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