Add a test for negative and zero pow() input.

PiperOrigin-RevId: 165650096
This commit is contained in:
A. Unique TensorFlower 2017-08-17 17:09:29 -07:00 committed by TensorFlower Gardener
parent a3c4e980e0
commit 8c0853db73

View File

@ -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>({});