You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AttributeError: 'torch.return_types.max' object has no attribute 'shape'" #8040
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
fix Project-MONAI#8040
Fix AttributeError when using torch.min and max (Project-MONAI#8041)