@@ -269,12 +269,15 @@ def squeeze_op(ctx, node, name, args):
269
269
del node .attr ["axis" ]
270
270
271
271
shape = ctx .get_shape (node .input [0 ])
272
- utils .make_sure (shape is not None , "squeeze input shape cannot be None" )
273
- shape_len = len (shape )
274
272
if axis and axis .ints :
275
273
axis = axis .ints
276
- axis = [a + shape_len if a < 0 else a for a in axis ]
274
+ neg_axis = any ([val < 0 for val in axis ])
275
+ if neg_axis :
276
+ utils .make_sure (shape is not None , "squeeze input shape cannot be None" )
277
+ shape_len = len (shape )
278
+ axis = [a + shape_len if a < 0 else a for a in axis ]
277
279
else :
280
+ utils .make_sure (shape is not None , "squeeze input shape cannot be None" )
278
281
axis = [i for i , j in enumerate (shape ) if j == 1 ]
279
282
node .set_attr ("axes" , axis )
280
283
@@ -450,7 +453,7 @@ def add_padding(ctx, node, kernel_shape, strides, dilations=None, spatial=2):
450
453
output_shape = spatial_map (output_shape , NHWC_TO_NCHW )
451
454
# calculate pads
452
455
if any (input_shape [i + 2 ] == - 1 for i in range (spatial )):
453
- log .warning ("node %s has unknown dim %s for pads calculation, fallback to auto_pad" % (
456
+ log .debug ("node %s has unknown dim %s for pads calculation, fallback to auto_pad" % (
454
457
node .name , str (input_shape )))
455
458
node .set_attr ("auto_pad" , "SAME_UPPER" )
456
459
else :
@@ -1207,7 +1210,6 @@ def minmax_op(ctx, node, name, args):
1207
1210
# get a tensor with zeros (since there is no Fill op as of opset8)
1208
1211
sub_node = ctx .make_node ("Sub" , [has_correct_shape , has_correct_shape ],
1209
1212
op_name_scope = input_node .name )
1210
-
1211
1213
# use add as 'broadcast' op
1212
1214
add_node = ctx .make_node ("Add" , [input_node .output [0 ], sub_node .output [0 ]],
1213
1215
op_name_scope = input_node .name )
0 commit comments