"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))
right_shape_been_input=False
whilenotright_shape_been_input:
try:
shape=raw_input(
"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: "
)
ifshape.count("-1")>1:
print("Only 1 dimension can be -1, type again:)")
else:
right_shape_been_input=True
ifshape=='N':
break
shape=[int(dim)fordiminshape.strip().split(',')]
assertshape.count(-1)<=1,"Only one dimension can be -1"
"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))
right_shape_been_input=False
whilenotright_shape_been_input:
try:
shape=raw_input(
"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: ")
ifshape.count("-1")>1:
print("Only 1 dimension can be -1, type again:)")
else:
right_shape_been_input=True
ifshape=='N':
break
shape=[int(dim)fordiminshape.strip().split(',')]
assertshape.count(-1)<=1,"Only one dimension can be -1"
self.fixed_input_shape[vi.name]=shape
defget_place_holder_nodes(self):
"""
...
...
@@ -206,7 +213,8 @@ class ONNXGraph(Graph):
inner_nodes=self.get_inner_nodes()
foript_viinself.graph.input:
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)
defget_output_nodes(self):
...
...
@@ -310,7 +318,7 @@ class ONNXGraph(Graph):
"""
ifnotisinstance(self.graph,onnx.GraphProto):
logger.error('graph is not a GraphProto instance')