提交 15afb0b4 编写于 作者: S SunAhong1993

fix

上级 14889935
......@@ -227,6 +227,8 @@ class ONNXGraph(Graph):
inner_nodes = self.get_inner_nodes()
for ipt_vi in self.graph.input:
if ipt_vi.name not in inner_nodes:
if len(ipt_vi.type.tensor_type.shape.dim) == 0:
continue
self.check_input_shape(ipt_vi)
self.place_holder_nodes.append(ipt_vi.name)
......
......@@ -216,7 +216,7 @@ class OpSet9():
node = parameter
dtype = node.dtype
shape = node.out_shapes[0]
if len(node.weight.shape) == 0:
if hasattr(node.weight, "shape") and len(node.weight.shape) == 0:
self.paddle_graph.add_layer(
"paddle.full",
inputs={},
......@@ -1694,6 +1694,16 @@ class OpSet9():
self.weights[val_b_name] = self.weights[val_b.name]
else:
layer_attrs["bias_attr"] = False
input_shape = val_x.out_shapes[0]
if reduce(lambda x,y:x*y, input_shape) in [1, -1] and 1 not in input_shape:
input_shape[1] = num_in_channels * num_groups
input_shape[0] = 0
input_shape[2] = 0
self.paddle_graph.add_layer(
"paddle.reshape",
inputs=layer_inputs,
outputs=[layer_inputs["x"]],
shape=input_shape)
self.paddle_graph.add_layer(
paddle_op,
inputs=layer_inputs,
......
......@@ -206,7 +206,7 @@ class OpSet9():
node = parameter
dtype = node.dtype
shape = node.out_shapes[0]
if len(node.weight.shape) == 0:
if hasattr(node.weight, "shape") and len(node.weight.shape) == 0:
self.paddle_graph.add_layer(
"paddle.full",
inputs={},
......@@ -1622,6 +1622,16 @@ class OpSet9():
}
if has_bias:
layer_inputs["bias"] = val_b.name
input_shape = val_x.out_shapes[0]
if reduce(lambda x,y:x*y, input_shape) in [1, -1] and 1 not in input_shape:
input_shape[1] = num_in_channels * num_groups
input_shape[0] = 0
input_shape[2] = 0
self.paddle_graph.add_layer(
"paddle.reshape",
inputs={"x": layer_inputs["x"]},
outputs=[layer_inputs["x"]],
shape=input_shape)
self.paddle_graph.add_layer(
paddle_op,
inputs=layer_inputs,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册