aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/cc/gradients/nn_grad_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/cc/gradients/nn_grad_test.cc')
-rw-r--r--tensorflow/cc/gradients/nn_grad_test.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/tensorflow/cc/gradients/nn_grad_test.cc b/tensorflow/cc/gradients/nn_grad_test.cc
index 64f1f76066..23545f75ac 100644
--- a/tensorflow/cc/gradients/nn_grad_test.cc
+++ b/tensorflow/cc/gradients/nn_grad_test.cc
@@ -138,5 +138,32 @@ TEST_F(NNGradTest, BiasAddGradHelper) {
RunTest({x, bias}, {shape, bias_shape}, {y}, {shape});
}
+TEST_F(NNGradTest, Conv2DGrad) {
+ TensorShape shape({1, 2, 2, 1});
+ auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(shape));
+ Tensor filter = test::AsTensor<float>({0.5f}, {1, 1, 1, 1});
+ const std::vector<int> strides{1, 1, 1, 1};
+ auto y = Conv2D(scope_, x, filter, strides, "SAME");
+ RunTest(x, shape, y, shape);
+}
+
+TEST_F(NNGradTest, MaxPoolGradHelper) {
+ TensorShape shape({1, 2, 2, 1});
+ auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(shape));
+ const std::vector<int> ksize{1, 2, 2, 1};
+ const std::vector<int> strides{1, 1, 1, 1};
+ auto y = MaxPool(scope_, x, ksize, strides, "SAME");
+ RunTest(x, shape, y, shape);
+}
+
+TEST_F(NNGradTest, MaxPoolGradV2Helper) {
+ TensorShape shape({1, 2, 2, 1});
+ auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(shape));
+ Tensor ksize = test::AsTensor<int>({1, 2, 2, 1}, {4});
+ Tensor strides = test::AsTensor<int>({1, 1, 1, 1}, {4});
+ auto y = MaxPoolV2(scope_, x, ksize, strides, "SAME");
+ RunTest(x, shape, y, shape);
+}
+
} // namespace
} // namespace tensorflow