diff options
author | 2017-10-17 12:23:29 -0700 | |
---|---|---|
committer | 2017-10-17 12:23:29 -0700 | |
commit | 568127ac3b8e501bb230ee287ec9a46129fad349 (patch) | |
tree | 53946f8bdbb1492e204327c1c418ad4e14708add /tensorflow/core/ops/image_ops_test.cc | |
parent | 962ed613cf1087637848d3e2b23f5b01d93c7eda (diff) |
Improve shape inference with `DecodeAndCropJpeg` (#13750)
* Improve shape inference with `DecodeAndCropJpeg`
While working on improving shape inference for several
other ops in 13561 and 13193, I noticed that `DecodeAndCropJpeg`
does not inference shape even though crop size might have already
be provided. In that case the shape will be `[h, w, channel]`
and `h`, `w` is part of the `crop_window`.
This fix updates the shape function in `DecodeAndCropJpeg`
for improving shape inference.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Add test cases to cover shape inference for `DecodeAndCropJpeg`
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Address failed unit tests
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Diffstat (limited to 'tensorflow/core/ops/image_ops_test.cc')
-rw-r--r-- | tensorflow/core/ops/image_ops_test.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tensorflow/core/ops/image_ops_test.cc b/tensorflow/core/ops/image_ops_test.cc index c34b11a15e..5f0b391b0d 100644 --- a/tensorflow/core/ops/image_ops_test.cc +++ b/tensorflow/core/ops/image_ops_test.cc @@ -105,7 +105,7 @@ TEST(ImageOpsTest, DecodeAndCropJpeg_ShapeFn) { .Input({"img", 0, DT_STRING}) .Input({"crop_window", 1, DT_INT32}) .Finalize(&op.node_def)); - INFER_OK(op, "[];[]", "[?,?,?]"); + INFER_OK(op, "[];[?]", "[?,?,?]"); // Set the channel, so that part of output shape is known. TF_ASSERT_OK(NodeDefBuilder("test", op_name) @@ -113,7 +113,7 @@ TEST(ImageOpsTest, DecodeAndCropJpeg_ShapeFn) { .Input({"crop_window", 1, DT_INT32}) .Attr("channels", 4) .Finalize(&op.node_def)); - INFER_OK(op, "[];[]", "[?,?,4]"); + INFER_OK(op, "[];[?]", "[?,?,4]"); // Negative channel value is rejected. TF_ASSERT_OK(NodeDefBuilder("test", op_name) @@ -139,7 +139,7 @@ TEST(ImageOpsTest, DecodeAndCropJpeg_InvalidCropWindow) { .Input({"img", 0, DT_STRING}) .Input({"crop_window", 1, DT_INT32}) .Finalize(&op.node_def)); - INFER_OK(op, "[];[]", "[?,?,?]"); + INFER_OK(op, "[];[?]", "[?,?,?]"); } TEST(ImageOpsTest, EncodeImage_ShapeFn) { |