-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Closed
Labels
module: docsRelated to our documentation, both in docs/ and docblocksRelated to our documentation, both in docs/ and docblocksmodule: linear algebraIssues related to specialized linear algebra operations in PyTorch; includes matrix multiply matmulIssues related to specialized linear algebra operations in PyTorch; includes matrix multiply matmultriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
🐛 Describe the bug
ord with str values and the length 3 of dim for linalg.norm() wrongly gets the error message with mut instead of must as shown below:
import torch
from torch import linalg
my_tensor = torch.tensor([[[8., -3., 0., 1.]]])
# ↓ ↓ ↓ ↓ ↓
linalg.norm(input=my_tensor, ord='fro', dim=(0, 1, 2)) # Error
# ↓ ↓ ↓ ↓ ↓
linalg.norm(input=my_tensor, ord='nuc', dim=(0, 1, 2)) # Error # ↓↓↓
RuntimeError: linalg.norm: If dim is specified, it mut be of length 1 or 2. Got [0, 1, 2]
In addition, ord with None and int values and the length 3 of dim for linalg.norm() properly gets the error message with must instead of mut as shown below:
import torch
from torch import linalg
my_tensor = torch.tensor([[[8., -3., 0., 1.]]])
# ↓ ↓ ↓ ↓
linalg.norm(input=my_tensor, ord=None, dim=(0, 1, 2)) # Error
# ↓ ↓ ↓
linalg.norm(input=my_tensor, ord=2, dim=(0, 1, 2)) # Error # ↓↓↓↓
RuntimeError: linalg.norm: If dim is specified, it must be of length 1 or 2. Got [0, 1, 2]
Versions
import torch
torch.__version__ # 2.4.1+cu121cc @svekars @brycebortree @sekyondaMeta @jianyuh @nikitaved @pearu @mruberry @walterddr @xwang233 @lezcano
Metadata
Metadata
Assignees
Labels
module: docsRelated to our documentation, both in docs/ and docblocksRelated to our documentation, both in docs/ and docblocksmodule: linear algebraIssues related to specialized linear algebra operations in PyTorch; includes matrix multiply matmulIssues related to specialized linear algebra operations in PyTorch; includes matrix multiply matmultriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module