Skip to content

Commit

Permalink
Add a test for negative and zero pow() input.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 165650096
  • Loading branch information
tensorflower-gardener committed Aug 18, 2017
1 parent a3c4e98 commit 8c0853d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tensorflow/compiler/xla/tests/array_elementwise_ops_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,17 @@ XLA_TEST_F(ArrayElementwiseOpTest, PowF32s) {
&builder, {16.0f, 0.25f, 8.0f, NAN, NAN, -8.0f, 16.0f}, {}, error_spec_);
}

XLA_TEST_F(ArrayElementwiseOpTest, PowNonIntegerF32s) {
SetFastMathDisabled(true);
ComputationBuilder builder(client_, TestName());
auto lhs = builder.ConstantR1<float>({-2.0f, -0.6f, -0.6f, 0.0f});
auto rhs = builder.ConstantR1<float>({0.5f, 0.6f, -0.6f, -0.6f});
auto minimum = builder.Pow(lhs, rhs);

ComputeAndCompareR1<float>(&builder, {NAN, NAN, NAN, INFINITY}, {},
error_spec_);
}

XLA_TEST_F(ArrayElementwiseOpTest, PowZeroElementF32s) {
ComputationBuilder builder(client_, TestName());
auto lhs = builder.ConstantR1<float>({});
Expand Down

0 comments on commit 8c0853d

Please sign in to comment.