Skip to content

Commit 2b3c23d

Browse files
authored
Merge pull request #457 from onnx/gs/fix-mobilenetv2
fix mobilnetv2
2 parents 5e98390 + 2f75c13 commit 2b3c23d

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

tests/run_pretrained_models.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,6 @@ googlenet_v4_slim:
176176
rtol: 0.1
177177

178178
mobilenet_v2_1.4_224:
179-
# fails because of input[1] in squeeze is 0 instead of 1
180-
disabled: true
181179
url: https://storage.googleapis.com/mobilenet_v2/checkpoints/mobilenet_v2_1.4_224.tgz
182180
model: mobilenet_v2_1.4_224_frozen.pb
183181
input_get: get_beach

tf2onnx/onnx_opset/nn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def add_padding(ctx, node, kernel_shape, strides, dilations=None, spatial=2):
149149
input_shape = spatial_map(input_shape, constants.NHWC_TO_NCHW)
150150
output_shape = spatial_map(output_shape, constants.NHWC_TO_NCHW)
151151
# calculate pads
152-
if any(input_shape[i + 2] == -1 for i in range(spatial)):
152+
if any(input_shape[i + 2] == -1 or output_shape[i + 2] == -1 for i in range(spatial)):
153153
logger.debug("node %s has unknown dim %d for pads calculation, fallback to auto_pad",
154154
node.name, input_shape)
155155
node.set_attr("auto_pad", "SAME_UPPER")

0 commit comments

Comments
 (0)