fixed nonzero
@@ -1880,28 +1880,11 @@ class OpSet9():
@print_mapping_info
def NonZero(self, node):
val_x = self.graph.get_input_node(node, idx=0, copy=True)
- val_x_dim = len(val_x.out_shapes[0])
- if val_x_dim == 1:
self.paddle_graph.add_layer(
"paddle.nonzero",
inputs={"x": val_x.name},
- outputs=[val_x.name])
- self.paddle_graph.add_layer(
- "paddle.transpose",
- inputs={"x": val_x.name},
- outputs=[node.layer_name],
- perm=[1, 0])
- if val_x_dim > 1:
- self.paddle_graph.add_layer(
- "paddle.nonzero",
- inputs={"x": val_x.name},
- outputs=[val_x.name])
- self.paddle_graph.add_layer(
- "paddle.split",
- inputs={"x": val_x.name},
outputs=[val_x.name],
- num_or_sections=1,
- axis=val_x_dim)
+ as_tuple=True)
self.paddle_graph.add_layer(
"paddle.concat", inputs={"x": val_x.name}, outputs=[node.name])
