"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."
"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))
.format(vi.name,shape))
...
@@ -182,12 +192,10 @@ class ONNXGraph(Graph):
...
@@ -182,12 +192,10 @@ class ONNXGraph(Graph):
whilenotright_shape_been_input:
whilenotright_shape_been_input:
try:
try:
shape=raw_input(
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:
except:
shape=input(
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:
ifshape.count("-1")>1:
print("Only 1 dimension can be -1, type again:)")
print("Only 1 dimension can be -1, type again:)")
else:
else:
...
@@ -197,7 +205,6 @@ class ONNXGraph(Graph):
...
@@ -197,7 +205,6 @@ class ONNXGraph(Graph):
shape=[int(dim)fordiminshape.strip().split(',')]
shape=[int(dim)fordiminshape.strip().split(',')]
assertshape.count(-1)<=1,"Only one dimension can be -1"
assertshape.count(-1)<=1,"Only one dimension can be -1"
self.fixed_input_shape[vi.name]=shape
self.fixed_input_shape[vi.name]=shape
break
defget_place_holder_nodes(self):
defget_place_holder_nodes(self):
"""
"""
...
@@ -206,6 +213,7 @@ class ONNXGraph(Graph):
...
@@ -206,6 +213,7 @@ class ONNXGraph(Graph):
inner_nodes=self.get_inner_nodes()
inner_nodes=self.get_inner_nodes()
foript_viinself.graph.input:
foript_viinself.graph.input:
ifipt_vi.namenotininner_nodes:
ifipt_vi.namenotininner_nodes:
ifself.define_input_shape:
self.check_input_shape(ipt_vi)
self.check_input_shape(ipt_vi)
self.place_holder_nodes.append(ipt_vi.name)
self.place_holder_nodes.append(ipt_vi.name)
...
@@ -310,7 +318,7 @@ class ONNXGraph(Graph):
...
@@ -310,7 +318,7 @@ class ONNXGraph(Graph):
"""
"""
ifnotisinstance(self.graph,onnx.GraphProto):
ifnotisinstance(self.graph,onnx.GraphProto):
logger.error('graph is not a GraphProto instance')