Skip to content

Commit 9199dcb

Browse files
authored
Update pytorch_parser.py
Add output shape check
1 parent e3dbf30 commit 9199dcb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mmdnn/conversion/pytorch/pytorch_parser.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ def _set_output_shape(self, source_node, IR_node):
127127

128128
new_dim = shape.dim.add()
129129

130+
if not shape_pytorch:
131+
print("Warning: Pytorch cannot inference outputshape of \"{}\" with operator \"{}\". Setting outputshape manually in json file is alternative .".format(source_node.name, source_node.type))
132+
IR_node.attr["_output_shapes"].list.shape.extend([shape])
133+
return
134+
130135
# (batch, C, H, W) & NHWC
131136
if len(shape_pytorch) == 4:
132137

0 commit comments

Comments
 (0)