Skip to content

Commit

Permalink
Update on "fix issue of baddbmm when out has nan value for beta=0"
Browse files Browse the repository at this point in the history

Fix #96037.

cc jgong5 mingfeima sanchitintel ashokei jingxu10

[ghstack-poisoned]
  • Loading branch information
XiaobingSuper committed Mar 7, 2023
1 parent f54e1c1 commit df0aa8e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions aten/src/ATen/native/LinearAlgebra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1557,6 +1557,7 @@ inline void baddbmm_cpu_kernel(const Tensor& result, const Tensor& self, const T
r += s2[k] * m1[k][j];
}
} else {
// For beta == 0, the r's value will be ignored, especially for nan value.
r = beta == scalar_t(0) ? scalar_t(0) : beta * r;
for (const auto k : c10::irange(ks)) {
r += alpha * s2[k] * m1[k][j];
Expand Down

0 comments on commit df0aa8e

Please sign in to comment.