Skip to content

Commit

Permalink
Revert #75195 (#82504) (#82662)
Browse files Browse the repository at this point in the history
This is a short-term fix for a serious regression in functorch
(pytorch/functorch#989).

Additional things this PR does:
- the out= tests for nn.functional.linear fail after the revert. I added
some xfails. These xfails were present in the original PR (#75195).
- the profiler tests fail on the revert, so I updated the expecttests
for the profiler tests

Test Plan:
- test offline that the functorch regression was fixed
Pull Request resolved: #82504
Approved by: https://github.com/ngimel, https://github.com/ezyang, https://github.com/atalman
  • Loading branch information
zou3519 committed Aug 2, 2022
1 parent 9a9dceb commit efc2d08
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion aten/src/ATen/native/LinearAlgebra.cpp
Expand Up @@ -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)) {
Expand Down
4 changes: 4 additions & 0 deletions torch/testing/_internal/common_methods_invocations.py
Expand Up @@ -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',
Expand Down Expand Up @@ -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'),
)),
Expand Down

0 comments on commit efc2d08

Please sign in to comment.