diff options
Diffstat (limited to 'tensorflow/core/ops/math_grad_test.cc')
-rw-r--r-- | tensorflow/core/ops/math_grad_test.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tensorflow/core/ops/math_grad_test.cc b/tensorflow/core/ops/math_grad_test.cc index 38813b3f2b..aa9706a328 100644 --- a/tensorflow/core/ops/math_grad_test.cc +++ b/tensorflow/core/ops/math_grad_test.cc @@ -495,6 +495,26 @@ TEST_F(MathGradTest, Log1p) { test::ExpectClose(ans, dx); } +TEST_F(MathGradTest, Sinh) { + auto x = test::AsTensor<float>({-3.f, -2.f, -1.f, 1.f, 2.f, 3.f}, + TensorShape({2, 3})); + auto g = [](float x) { return std::cosh(x); }; + auto dx = test::AsTensor<float>( + {g(-3.f), g(-2.f), g(-1.f), g(1.f), g(2.f), g(3.f)}, TensorShape({2, 3})); + auto ans = SymGrad("Sinh", x); + test::ExpectClose(ans, dx); +} + +TEST_F(MathGradTest, Cosh) { + auto x = test::AsTensor<float>({-3.f, -2.f, -1.f, 1.f, 2.f, 3.f}, + TensorShape({2, 3})); + auto g = [](float x) { return std::sinh(x); }; + auto dx = test::AsTensor<float>( + {g(-3.f), g(-2.f), g(-1.f), g(1.f), g(2.f), g(3.f)}, TensorShape({2, 3})); + auto ans = SymGrad("Cosh", x); + test::ExpectClose(ans, dx); +} + TEST_F(MathGradTest, Tanh) { auto x = test::AsTensor<float>({-3.f, -2.f, -1.f, 1.f, 2.f, 3.f}, TensorShape({2, 3})); |