"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."
try:
.format(vi.name,shape))
shape=raw_input(
right_shape_been_input=False
"Shape of Input(e.g. -1,3,224,224), enter 'N' to skip: "
whilenotright_shape_been_input:
)
try:
except:
shape=raw_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: "
except:
)
shape=input(
ifshape.count("-1")>1:
"Shape of Input(e.g. -1,3,224,224), enter 'N' to skip: ")
print("Only 1 dimension can be -1, type again:)")
ifshape.count("-1")>1:
else:
print("Only 1 dimension can be -1, type again:)")
right_shape_been_input=True
else:
ifshape=='N':
right_shape_been_input=True
break
ifshape=='N':
shape=[int(dim)fordiminshape.strip().split(',')]
break
assertshape.count(-1)<=1,"Only one dimension can be -1"
shape=[int(dim)fordiminshape.strip().split(',')]
self.fixed_input_shape[vi.name]=shape
assertshape.count(-1)<=1,"Only one dimension can be -1"
break
self.fixed_input_shape[vi.name]=shape
defget_place_holder_nodes(self):
defget_place_holder_nodes(self):
"""
"""
...
@@ -206,7 +213,8 @@ class ONNXGraph(Graph):
...
@@ -206,7 +213,8 @@ 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:
self.check_input_shape(ipt_vi)
ifself.define_input_shape:
self.check_input_shape(ipt_vi)
self.place_holder_nodes.append(ipt_vi.name)
self.place_holder_nodes.append(ipt_vi.name)
defget_output_nodes(self):
defget_output_nodes(self):
...
@@ -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')