Skip to content

Commit da85fe6

Browse files
committed
Keep empty U and Vh for svdvals
1 parent 2f0c348 commit da85fe6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/ATen/native/xpu/mkl/BatchLinearAlgebra.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,14 @@ void svd_mkl(
350350
const Tensor& info) {
351351
Tensor U_tmp, S_tmp, Vh_tmp;
352352
bool some = !full_matrices;
353+
std::tie(U_tmp, S_tmp, Vh_tmp) = _svd_helper(A, some, compute_uv);
353354

354-
std::tie(U_tmp, S_tmp, Vh_tmp) = _svd_helper(A, some, /*compute_uv=*/true);
355-
svd_resize_and_copy("U", U_tmp, U);
355+
// TODO: Remove copy
356+
if (compute_uv) {
357+
svd_resize_and_copy("U", U_tmp, U);
358+
svd_resize_and_copy("Vh", Vh_tmp, Vh);
359+
}
356360
svd_resize_and_copy("S", S_tmp, S);
357-
svd_resize_and_copy("V", Vh_tmp, Vh);
358361
}
359362

360363
} // namespace at::native::xpu

0 commit comments

Comments
 (0)