"Unknown shape for input tensor[tensor name: '{}'] -> shape: {}, Please define shape of input here,\nNote:you can use visualization tools like Netron to check input shape."
.format(vi.name,shape))
...
...
@@ -182,12 +192,10 @@ class ONNXGraph(Graph):
whilenotright_shape_been_input:
try:
shape=raw_input(
"Shape of Input(e.g. -1,3,224,224), enter 'N' to skip: "
)
"Shape of Input(e.g. -1,3,224,224), enter 'N' to skip: ")
except:
shape=input(
"Shape of Input(e.g. -1,3,224,224), enter 'N' to skip: "
)
"Shape of Input(e.g. -1,3,224,224), enter 'N' to skip: ")
ifshape.count("-1")>1:
print("Only 1 dimension can be -1, type again:)")
else:
...
...
@@ -197,7 +205,6 @@ class ONNXGraph(Graph):
shape=[int(dim)fordiminshape.strip().split(',')]
assertshape.count(-1)<=1,"Only one dimension can be -1"
self.fixed_input_shape[vi.name]=shape
break
defget_place_holder_nodes(self):
"""
...
...
@@ -206,6 +213,7 @@ class ONNXGraph(Graph):
inner_nodes=self.get_inner_nodes()
foript_viinself.graph.input:
ifipt_vi.namenotininner_nodes:
ifself.define_input_shape:
self.check_input_shape(ipt_vi)
self.place_holder_nodes.append(ipt_vi.name)
...
...
@@ -310,7 +318,7 @@ class ONNXGraph(Graph):
"""
ifnotisinstance(self.graph,onnx.GraphProto):
logger.error('graph is not a GraphProto instance')