diff options
author | 2016-12-15 16:31:39 -0800 | |
---|---|---|
committer | 2016-12-15 16:46:24 -0800 | |
commit | a697ad1c905dbb02be6c3602eb3b229f36584740 (patch) | |
tree | 510025bdb7dafba1f1485009f2426472ed1ee6a0 /tensorflow/core/kernels/resize_bilinear_op_test.cc | |
parent | 7b6d8ada59346b11a1526af265fc38cc2a0fa9a3 (diff) |
Remove unnecessary zero check from resize_bilinear_op.cc.
Additionally, update the resize_bilinear_op tests to ensure they fail with a given error.
Change: 142204006
Diffstat (limited to 'tensorflow/core/kernels/resize_bilinear_op_test.cc')
-rw-r--r-- | tensorflow/core/kernels/resize_bilinear_op_test.cc | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/tensorflow/core/kernels/resize_bilinear_op_test.cc b/tensorflow/core/kernels/resize_bilinear_op_test.cc index 66836ff788..32acdf2df8 100644 --- a/tensorflow/core/kernels/resize_bilinear_op_test.cc +++ b/tensorflow/core/kernels/resize_bilinear_op_test.cc @@ -302,21 +302,41 @@ TEST_F(ResizeBilinearOpTest, TestBilinear2x2To4x4) { test::ExpectTensorEqual<float>(expected, *GetOutput(0)); } +TEST_F(ResizeBilinearOpTest, TestInvalidOutputSize) { + AddInputFromArray<float>(TensorShape({1, 2, 2, 1}), {1, 2, 3, 4}); + AddInputFromArray<int32>(TensorShape({2}), {0, 0}); + Status s = RunOpKernel(); + EXPECT_TRUE( + StringPiece(s.ToString()) + .contains("Invalid argument: output dimensions must be positive")) + << s; +} + TEST_F(ResizeBilinearOpTest, TestInvalidInputShape) { AddInputFromArray<float>(TensorShape({2, 2, 1}), {1, 2, 3, 4}); AddInputFromArray<int32>(TensorShape({2}), {4, 4}); - ASSERT_FALSE(RunOpKernel().ok()); + Status s = RunOpKernel(); + EXPECT_TRUE(StringPiece(s.ToString()) + .contains("Invalid argument: input must be 4-dimensional")) + << s; } TEST_F(ResizeBilinearOpTest, TestInvalidSizeDim) { AddInputFromArray<float>(TensorShape({1, 2, 2, 1}), {1, 2, 3, 4}); AddInputFromArray<int32>(TensorShape({2, 1}), {4, 4}); - ASSERT_FALSE(RunOpKernel().ok()); + Status s = RunOpKernel(); + EXPECT_TRUE(StringPiece(s.ToString()) + .contains("Invalid argument: shape_t must be 1-dimensional")) + << s; } + TEST_F(ResizeBilinearOpTest, TestInvalidSizeElements) { AddInputFromArray<float>(TensorShape({1, 2, 2, 1}), {1, 2, 3, 4}); AddInputFromArray<int32>(TensorShape({3}), {4, 4, 1}); - ASSERT_FALSE(RunOpKernel().ok()); + Status s = RunOpKernel(); + EXPECT_TRUE(StringPiece(s.ToString()) + .contains("Invalid argument: shape_t must have two elements")) + << s; } } // namespace tensorflow |