Skip to content

Commit 92f669e

Browse files
malfetpytorchmergebot
authored andcommitted
[BE] Use c10::multiply_integers in cholesky_impl (pytorch#147163)
That replaces explicit for loop Pull Request resolved: pytorch#147163 Approved by: https://github.com/huydhn
1 parent 2d089a5 commit 92f669e

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

aten/src/ATen/native/mps/operations/LinearAlgebra.mm

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,10 +1075,7 @@ static void linalg_cholesky_mps_impl(const Tensor& input,
10751075

10761076
int64_t ndim = out.dim();
10771077
int64_t N = out.size(-1);
1078-
int64_t B = 1;
1079-
for (int64_t i = 0; i < ndim - 2; i++) {
1080-
B *= out.size(i);
1081-
}
1078+
int64_t B = c10::multiply_integers(input_sizes.begin(), input_sizes.end() - 2);
10821079

10831080
auto stream = getCurrentMPSStream();
10841081
auto device = MPSDevice::getInstance()->device();

0 commit comments

Comments
 (0)