Add missing -inf order for linalg.norm OpInfo (#51233)
Summary:
Follow up to https://github.com/pytorch/pytorch/issues/50746
I accidentally missed the `ord=-inf` case in the OpInfo for `torch.linalg.norm` when I wrote it.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51233
Reviewed By: malfet
Differential Revision: D26117160
Pulled By: anjali411
fbshipit-source-id: af921c1d8004783612b3a477ae2025a82860ff4e
diff --git a/torch/testing/_internal/common_methods_invocations.py b/torch/testing/_internal/common_methods_invocations.py
index 324a934..09f9ea2 100644
--- a/torch/testing/_internal/common_methods_invocations.py
+++ b/torch/testing/_internal/common_methods_invocations.py
@@ -351,7 +351,7 @@
(0, 0, 0),
]
- vector_ords = (None, 0, 0.5, 1, 2, 3.5, inf, -0.5, -1, -2, -3.5)
+ vector_ords = (None, 0, 0.5, 1, 2, 3.5, inf, -0.5, -1, -2, -3.5, -inf)
matrix_ords = (None, 'fro', 'nuc', 1, 2, inf, -1, -2, -inf)
inputs = []
@@ -379,7 +379,7 @@
# TODO: remove this check when `max` is implemented for
# float16 and bfloat16. Issue:
# https://github.com/pytorch/pytorch/issues/50790
- if is_vector_norm and is_dtype_half and ord == inf:
+ if is_vector_norm and is_dtype_half and ord in [inf, -inf]:
continue
inputs.append(SampleInput(