Skip to content

Commit 4f42d92

Browse files
committed
docs: expand non-empty output constraint for ExtractImagePatches
Signed-off-by: Nanoskript <[email protected]>
1 parent 36f203b commit 4f42d92

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tf2onnx/onnx_opset/nn.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -2105,7 +2105,19 @@ def version_9(cls, ctx, node, **kwargs):
21052105
rates = node.get_attr_value("rates")
21062106
padding = node.get_attr_str("padding")
21072107

2108-
# Our constraints.
2108+
# This implementation of ExtractImagePatches does not generalize
2109+
# to outputs that are empty. For example:
2110+
#
2111+
# tf.image.extract_patches(
2112+
# np.random.rand(1, 1, 1, 1), sizes=[1, 2, 2, 1], strides=[1, 1, 1, 1],
2113+
# rates=[1, 1, 1, 1], padding="VALID"
2114+
# )
2115+
#
2116+
# succeeds with the output of:
2117+
#
2118+
# <tf.Tensor: shape=(1, 0, 0, 4), dtype=float64, numpy=array([], shape=(1, 0, 0, 4), dtype=float64)>
2119+
#
2120+
# whereas attempting the same here results in an "Invalid input shape" error for the "Conv" node.
21092121
utils.make_sure(0 not in output_shape, "Empty ExtractImagePatches output is unsupported.")
21102122
[_, size_rows, size_cols, _] = sizes
21112123

0 commit comments

Comments
 (0)