aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/cc/gradients/math_grad_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/cc/gradients/math_grad_test.cc')
-rw-r--r--tensorflow/cc/gradients/math_grad_test.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/tensorflow/cc/gradients/math_grad_test.cc b/tensorflow/cc/gradients/math_grad_test.cc
index 3534f16e8f..a174f223ad 100644
--- a/tensorflow/cc/gradients/math_grad_test.cc
+++ b/tensorflow/cc/gradients/math_grad_test.cc
@@ -821,5 +821,17 @@ TEST_F(NaryGradTest, Minimum) {
RunTest(x, x_init_value, y, shape);
}
+TEST_F(NaryGradTest, Lgamma) {
+ TensorShape shape({3, 2});
+ auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(shape));
+ auto y = Lgamma(scope_, x);
+ // Select values to avoid instability when computing finite differences.
+ // Ref: https://en.wikipedia.org/wiki/File:Gamma_plot.svg
+ Tensor x_init_value =
+ test::AsTensor<float>({-3.5f, -2.5f, -1.5f, 1.0f, 2.0f, 3.5f}, {3, 2});
+ RunTest(x, x_init_value, y, shape);
+ // TODO(suharshs): add test case for complex values
+}
+
} // namespace
} // namespace tensorflow