diff --git a/x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py b/x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py index e30bef79e204692e66975a7638effddf8bcded34..e860366b919e6c4e526bd83dfa7f7d85a38493cf 100644 --- a/x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py +++ b/x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py @@ -1526,3 +1526,21 @@ class TFOpMapper(OpMapper): inputs=inputs, outputs=[node.name], **attr) + + def ReverseV2(self, node): + x = self.graph.get_input_node(node, 0) + axis = self.graph.get_input_node(node, 1) + inputs = {"x": x.name} + attr = dict() + if axis.layer_type == 'Const': + axis = axis.value.tolist() + if not isinstance(axis, list): + axis = [axis] + attr['axis'] = axis + else: + inputs['axis'] = axis.name + self.paddle_graph.add_layer( + "paddle.flip", + inputs=inputs, + outputs=[node.name], + **attr) diff --git a/x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py b/x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py index 7df97dc6dda557102a1b1cd8e7b68a0ef5963b7d..5370519671e1af32fae95569bb3c61e91e4e9222 100644 --- a/x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py +++ b/x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py @@ -1509,3 +1509,22 @@ class TFOpMapper(OpMapper): inputs=inputs, outputs=[node.name], **attr) + + def ReverseV2(self, node): + x = self.graph.get_input_node(node, 0) + axis = self.graph.get_input_node(node, 1) + inputs = {"x": x.name} + attr = dict() + if axis.layer_type == 'Const': + axis = axis.value.tolist() + if not isinstance(axis, list): + axis = [axis] + attr['axis'] = axis + else: + inputs['axis'] = axis.name + self.paddle_graph.add_layer( + "paddle.flip", + inputs=inputs, + outputs=[node.name], + **attr) +