Symintify transpose_ (#149057)

Fixes https://github.com/pytorch/pytorch/issues/148702
Pull Request resolved: https://github.com/pytorch/pytorch/pull/149057
Approved by: https://github.com/yushangdi
This commit is contained in:
angelayi 2025-03-17 19:11:51 +00:00 committed by PyTorch MergeBot
parent 08a644a4c4
commit 8d7c430e84
2 changed files with 4 additions and 5 deletions

View File

@ -3610,11 +3610,11 @@ Tensor& transpose_(Tensor& self, int64_t dim0, int64_t dim1) {
return at::_mkldnn_transpose_(self, dim0, dim1); return at::_mkldnn_transpose_(self, dim0, dim1);
} }
DimVector sizes(self.sizes().begin(), self.sizes().end()); SymDimVector sizes(self.sym_sizes().begin(), self.sym_sizes().end());
DimVector strides(self.strides().begin(), self.strides().end());
std::swap(strides[dim0], strides[dim1]);
std::swap(sizes[dim0], sizes[dim1]); std::swap(sizes[dim0], sizes[dim1]);
self.as_strided_(sizes, strides); SymDimVector strides(self.sym_strides().begin(), self.sym_strides().end());
std::swap(strides[dim0], strides[dim1]);
auto result = self.as_strided__symint(std::move(sizes), std::move(strides));
return self; return self;
} }

View File

@ -6557,7 +6557,6 @@ symbolic_aot_autograd_failures = {
"linalg.householder_product", "linalg.householder_product",
decorator=unittest.skipIf(IS_MACOS and IS_X86, "flaky"), decorator=unittest.skipIf(IS_MACOS and IS_X86, "flaky"),
), ),
xfail("stft", ""), # Cannot call sizes() on tensor with symbolic sizes/strides
} }