Skip to content

Commit

Permalink
Fix incorrect pow(x, 0) case. (pytorch#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
resistor authored Feb 12, 2020
1 parent 67a97bc commit 8cfdd14
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions torch/csrc/jit/tensorexpr/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ Tensor TensorExprKernel::ComputeValue(torch::jit::Value* v) {
} else if (imm = 0.5f) {
return sqrt(lhs);
} else if (imm == 0.0f) {
return Expr(0.0f);
return Expr(1.0f);
} else if (imm == -0.5f) {
return rsqrt(lhs);
} else if (imm == -1.0f) {
Expand All @@ -414,7 +414,7 @@ Tensor TensorExprKernel::ComputeValue(torch::jit::Value* v) {
Expr tmp = lhs * lhs;
return tmp * tmp;
} else if (imm == 0) {
return Expr(0.0f);
return Expr(1.0f);
} else if (imm == -1) {
return Expr(1.0f) / lhs;
} else if (imm == -2) {
Expand Down

0 comments on commit 8cfdd14

Please sign in to comment.