From 0b0335f9695288d18a52e169aa051387f0fd2f84 Mon Sep 17 00:00:00 2001 From: SunAhong1993 Date: Wed, 2 Dec 2020 15:08:09 +0800 Subject: [PATCH] add beg --- x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py | 9 +++++++++ x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py b/x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py index a326e8a..f08c2fc 100644 --- a/x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py +++ b/x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py @@ -248,6 +248,15 @@ class TFOpMapper(OpMapper): inputs={"x": input.name}, outputs=[node.name], perm=perm) + + def Neg(self, node): + input = self.graph.get_input_node(node, 0) + + self.paddle_graph.add_layer( + "paddle.scale", + inputs={"x": input.name}, + outputs=[node.name], + scale=-1) def Fill(self, node): dims = self.graph.get_input_node(node, 0) diff --git a/x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py b/x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py index 851810e..037b68a 100644 --- a/x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py +++ b/x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py @@ -304,6 +304,15 @@ class TFOpMapper(OpMapper): inputs={"x": node.name}, outputs=[node.name], perm=[0, 2, 3, 1]) + + def Neg(self, node): + input = self.graph.get_input_node(node, 0) + + self.paddle_graph.add_layer( + "paddle.scale", + inputs={"x": input.name}, + outputs=[node.name], + scale=-1) def MaxPool(self, node): input = self.graph.get_node(node.layer.input[0]) -- GitLab