Skip to content

AttributeError: 'torch.return_types.max' object has no attribute 'shape'" #8040

Closed

Description

@KumoLiu
import torch
from monai.transforms.utils_pytorch_numpy_unification import max

a = torch.rand(6, 8, 3)
b = max(a, dim=1)
print(type(b), (isinstance(b, tuple)))
print(b.shape)

Return:

<class 'torch.return_types.max'> True
{
	"name": "AttributeError",
	"message": "'torch.return_types.max' object has no attribute 'shape'",
	"stack": "---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[8], line 7
      5 b = max(a, dim=1)
      6 print(type(b), (isinstance(b, tuple)))
----> 7 print(b.shape)

AttributeError: 'torch.return_types.max' object has no attribute 'shape'"
}

Activity

  1. added a commit that references this issue on Aug 22, 2024
    f5a7da8
  2. added a commit that references this issue on Aug 23, 2024
    de2a819
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions