diff --git a/aten/src/ATen/native/LinearAlgebra.cpp b/aten/src/ATen/native/LinearAlgebra.cpp index 8721080816de3..4bf90198dd8bb 100644 --- a/aten/src/ATen/native/LinearAlgebra.cpp +++ b/aten/src/ATen/native/LinearAlgebra.cpp @@ -1712,7 +1712,8 @@ Tensor _matmul_impl( } else if (dim_tensor1 == 2 && dim_tensor2 == 1) { return has_out ? at::mv_out(out, tensor1, tensor2) : tensor1.mv(tensor2); } else if (dim_tensor1 == 1 && dim_tensor2 == 2) { - return has_out ? at::mv_out(out, tensor2.t(), tensor1) : tensor2.t().mv(tensor1); + return has_out ? at::mm_out(out, tensor1.unsqueeze(0), tensor2).squeeze_(0) + : tensor1.unsqueeze(0).mm(tensor2).squeeze_(0); } else if (dim_tensor1 == 2 && dim_tensor2 == 2) { return has_out ? at::mm_out(out, tensor1, tensor2) : tensor1.mm(tensor2); } else if (should_fold(tensor1, dim_tensor2) || should_fold(tensor2, dim_tensor1)) { diff --git a/torch/testing/_internal/common_methods_invocations.py b/torch/testing/_internal/common_methods_invocations.py index 939ca9077e5b0..00eb3f7f09b5f 100644 --- a/torch/testing/_internal/common_methods_invocations.py +++ b/torch/testing/_internal/common_methods_invocations.py @@ -12192,6 +12192,8 @@ def error_inputs_mean(op_info, device, **kwargs): 'TestCommon', 'test_noncontiguous_samples', device_type='cpu'), ], skips=( + # Strides are not the same! + DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_out'), # https://github.com/pytorch/pytorch/issues/67470 DecorateInfo(unittest.skip("67470!"), 'TestCommon', 'test_noncontiguous_samples', @@ -13517,6 +13519,8 @@ def error_inputs_mean(op_info, device, **kwargs): DecorateInfo(unittest.expectedFailure, 'TestCompositeCompliance', 'test_forward_ad'), ), decorators=( + # Strides are not the same! + DecorateInfo(unittest.expectedFailure, 'TestCommon', 'test_out'), DecorateInfo(toleranceOverride({torch.float16: tol(atol=1e-02, rtol=1e-02)}), 'TestCudaFuserOpInfo', 'test_nvfuser_correctness'), )),