From ee48679c0613843855807f6f71b972a01299570e Mon Sep 17 00:00:00 2001 From: SunAhong1993 Date: Wed, 9 Dec 2020 11:59:32 +0800 Subject: [PATCH] add tf static --- x2paddle/convert.py | 15 +- .../dygraph/tf2paddle/tf_op_mapper.py | 22 +- .../static/caffe2paddle/caffe_op_mapper.py | 3 +- .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 175 bytes .../__pycache__/tf_op_mapper.cpython-37.pyc | Bin 0 -> 38311 bytes .../static/tf2paddle/tf_op_mapper.py | 589 +++++++++--------- .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 158 bytes .../__pycache__/optimizer.cpython-37.pyc | Bin 0 -> 1897 bytes .../__pycache__/pass_.cpython-37.pyc | Bin 0 -> 746 bytes .../__pycache__/pass_manager.cpython-37.pyc | Bin 0 -> 1106 bytes .../pattern_matcher.cpython-37.pyc | Bin 0 -> 7474 bytes .../code_optimizer/hierachical_tree.py | 10 +- .../code_optimizer/layer_code_generator.py | 32 +- .../code_optimizer/subgraphs_union.py | 16 +- .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 170 bytes .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 329 bytes .../transpose_eliminate_pass.cpython-37.pyc | Bin 0 -> 962 bytes .../transpose_elimination.cpython-37.pyc | Bin 0 -> 6076 bytes .../optimizer/elimination/static/__init__.py | 16 + .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 326 bytes .../transpose_eliminate_pass.cpython-37.pyc | Bin 0 -> 963 bytes .../transpose_elimination.cpython-37.pyc | Bin 0 -> 6132 bytes .../static/transpose_eliminate_pass.py | 33 + .../static/transpose_elimination.py | 291 +++++++++ .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 165 bytes .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 1715 bytes .../adaptive_pool2d_fuse_pass.cpython-37.pyc | Bin 0 -> 1007 bytes .../adaptive_pool2d_fuser.cpython-37.pyc | Bin 0 -> 4662 bytes .../batchnorm2d_fuse_pass.cpython-37.pyc | Bin 0 -> 983 bytes .../batchnorm2d_fuser.cpython-37.pyc | Bin 0 -> 4166 bytes .../bn_scale_fuse_pass.cpython-37.pyc | Bin 0 -> 958 bytes .../__pycache__/bn_scale_fuser.cpython-37.pyc | Bin 0 -> 2948 bytes .../constant_fuse_pass.cpython-37.pyc | Bin 0 -> 962 bytes .../__pycache__/constant_fuser.cpython-37.pyc | Bin 0 -> 2187 bytes .../conv2d_add_fuse_pass.cpython-37.pyc | Bin 0 -> 955 bytes .../conv2d_add_fuser.cpython-37.pyc | Bin 0 -> 3710 bytes .../dropout_fuse_pass.cpython-37.pyc | Bin 0 -> 955 bytes .../__pycache__/dropout_fuser.cpython-37.pyc | Bin 0 -> 2168 bytes .../__pycache__/fc_fuse_pass.cpython-37.pyc | Bin 0 -> 920 bytes .../__pycache__/fc_fuser.cpython-37.pyc | Bin 0 -> 4197 bytes ...erpolate_bilinear_fuse_pass.cpython-37.pyc | Bin 0 -> 1042 bytes .../interpolate_bilinear_fuser.cpython-37.pyc | Bin 0 -> 6426 bytes .../prelu_fuse_pass.cpython-37.pyc | Bin 0 -> 929 bytes .../__pycache__/prelu_fuser.cpython-37.pyc | Bin 0 -> 4020 bytes .../reshape_fuse_pass.cpython-37.pyc | Bin 0 -> 955 bytes .../__pycache__/reshape_fuser.cpython-37.pyc | Bin 0 -> 2312 bytes .../tf_batchnorm_fuse_pass.cpython-37.pyc | Bin 0 -> 967 bytes .../tf_batchnorm_fuser.cpython-37.pyc | Bin 0 -> 4811 bytes .../trace_fc_fuse_pass.cpython-37.pyc | Bin 0 -> 907 bytes .../__pycache__/trace_fc_fuser.cpython-37.pyc | Bin 0 -> 3668 bytes .../fusion/dygraph/conv2d_add_fuser.py | 4 - x2paddle/optimizer/fusion/static/__init__.py | 9 +- .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 672 bytes .../bn_scale_fuse_pass.cpython-37.pyc | Bin 0 -> 955 bytes .../__pycache__/bn_scale_fuser.cpython-37.pyc | Bin 0 -> 3692 bytes .../conv2d_add_fuse_pass.cpython-37.pyc | Bin 0 -> 948 bytes .../conv2d_add_fuser.cpython-37.pyc | Bin 0 -> 4323 bytes .../prelu_fuse_pass.cpython-37.pyc | Bin 0 -> 922 bytes .../__pycache__/prelu_fuser.cpython-37.pyc | Bin 0 -> 4088 bytes ...static_conv2d_add_fuse_pass.cpython-37.pyc | Bin 0 -> 955 bytes .../tf_batchnorm_fuse_pass.cpython-37.pyc | Bin 0 -> 960 bytes .../tf_batchnorm_fuser.cpython-37.pyc | Bin 0 -> 4768 bytes .../optimizer/fusion/static/bn_scale_fuser.py | 1 - .../fusion/static/conv2d_add_fuse_pass.py | 33 + .../fusion/static/conv2d_add_fuser.py | 121 ++++ .../fusion/static/prelu_fuse_pass.py | 33 + .../optimizer/fusion/static/prelu_fuser.py | 139 +++++ .../fusion/static/tf_batchnorm_fuse_pass.py | 33 + .../fusion/static/tf_batchnorm_fuser.py | 227 +++++++ x2paddle/optimizer/optimizer.py | 24 +- .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 169 bytes .../__pycache__/batch_norm.cpython-37.pyc | Bin 0 -> 3649 bytes .../__pycache__/bias.cpython-37.pyc | Bin 0 -> 1798 bytes .../__pycache__/prelu.cpython-37.pyc | Bin 0 -> 2861 bytes .../__pycache__/transpose.cpython-37.pyc | Bin 0 -> 5628 bytes 75 files changed, 1278 insertions(+), 373 deletions(-) create mode 100644 x2paddle/op_mapper/static/tf2paddle/__pycache__/__init__.cpython-37.pyc create mode 100644 x2paddle/op_mapper/static/tf2paddle/__pycache__/tf_op_mapper.cpython-37.pyc create mode 100644 x2paddle/optimizer/__pycache__/__init__.cpython-37.pyc create mode 100644 x2paddle/optimizer/__pycache__/optimizer.cpython-37.pyc create mode 100644 x2paddle/optimizer/__pycache__/pass_.cpython-37.pyc create mode 100644 x2paddle/optimizer/__pycache__/pass_manager.cpython-37.pyc create mode 100644 x2paddle/optimizer/__pycache__/pattern_matcher.cpython-37.pyc create mode 100644 x2paddle/optimizer/elimination/__pycache__/__init__.cpython-37.pyc create mode 100644 x2paddle/optimizer/elimination/dygraph/__pycache__/__init__.cpython-37.pyc create mode 100644 x2paddle/optimizer/elimination/dygraph/__pycache__/transpose_eliminate_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/elimination/dygraph/__pycache__/transpose_elimination.cpython-37.pyc create mode 100644 x2paddle/optimizer/elimination/static/__init__.py create mode 100644 x2paddle/optimizer/elimination/static/__pycache__/__init__.cpython-37.pyc create mode 100644 x2paddle/optimizer/elimination/static/__pycache__/transpose_eliminate_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/elimination/static/__pycache__/transpose_elimination.cpython-37.pyc create mode 100644 x2paddle/optimizer/elimination/static/transpose_eliminate_pass.py create mode 100644 x2paddle/optimizer/elimination/static/transpose_elimination.py create mode 100644 x2paddle/optimizer/fusion/__pycache__/__init__.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/__init__.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/adaptive_pool2d_fuse_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/adaptive_pool2d_fuser.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/batchnorm2d_fuse_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/batchnorm2d_fuser.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/bn_scale_fuse_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/bn_scale_fuser.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/constant_fuse_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/constant_fuser.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/conv2d_add_fuse_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/conv2d_add_fuser.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/dropout_fuse_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/dropout_fuser.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/fc_fuse_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/fc_fuser.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/interpolate_bilinear_fuse_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/interpolate_bilinear_fuser.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/prelu_fuse_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/prelu_fuser.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/reshape_fuse_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/reshape_fuser.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/tf_batchnorm_fuse_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/tf_batchnorm_fuser.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/trace_fc_fuse_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/dygraph/__pycache__/trace_fc_fuser.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/static/__pycache__/__init__.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/static/__pycache__/bn_scale_fuse_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/static/__pycache__/bn_scale_fuser.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/static/__pycache__/conv2d_add_fuse_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/static/__pycache__/conv2d_add_fuser.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/static/__pycache__/prelu_fuse_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/static/__pycache__/prelu_fuser.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/static/__pycache__/static_conv2d_add_fuse_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/static/__pycache__/tf_batchnorm_fuse_pass.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/static/__pycache__/tf_batchnorm_fuser.cpython-37.pyc create mode 100644 x2paddle/optimizer/fusion/static/conv2d_add_fuse_pass.py create mode 100644 x2paddle/optimizer/fusion/static/conv2d_add_fuser.py create mode 100644 x2paddle/optimizer/fusion/static/prelu_fuse_pass.py create mode 100644 x2paddle/optimizer/fusion/static/prelu_fuser.py create mode 100644 x2paddle/optimizer/fusion/static/tf_batchnorm_fuse_pass.py create mode 100644 x2paddle/optimizer/fusion/static/tf_batchnorm_fuser.py create mode 100644 x2paddle/optimizer/tensorflow/__pycache__/__init__.cpython-37.pyc create mode 100644 x2paddle/optimizer/tensorflow/__pycache__/batch_norm.cpython-37.pyc create mode 100644 x2paddle/optimizer/tensorflow/__pycache__/bias.cpython-37.pyc create mode 100644 x2paddle/optimizer/tensorflow/__pycache__/prelu.cpython-37.pyc create mode 100644 x2paddle/optimizer/tensorflow/__pycache__/transpose.cpython-37.pyc diff --git a/x2paddle/convert.py b/x2paddle/convert.py index 7b38f27..3de2951 100644 --- a/x2paddle/convert.py +++ b/x2paddle/convert.py @@ -132,18 +132,9 @@ def tf2paddle(model_path, graph_opt = GraphOptimizer(source_frame="tf", paddle_type=paddle_type) graph_opt.optimize(mapper.paddle_graph) else: - from x2paddle.optimizer.tensorflow.bias import BiasOpt - from x2paddle.optimizer.tensorflow.transpose import TransposeOpt - from x2paddle.optimizer.tensorflow.batch_norm import BatchNormOpt - from x2paddle.optimizer.tensorflow.prelu import PReLUOpt - bias_opt = BiasOpt() - transpose_opt = TransposeOpt() - batch_norm_opt = BatchNormOpt() - prelu_opt = PReLUOpt() - bias_opt.run(mapper.paddle_graph) - batch_norm_opt.run(mapper.paddle_graph) - prelu_opt.run(mapper.paddle_graph) - transpose_opt.run(mapper.paddle_graph) + from x2paddle.optimizer.optimizer import GraphOptimizer + graph_opt = GraphOptimizer(source_frame="tf", paddle_type=paddle_type) + graph_opt.optimize(mapper.paddle_graph) mapper.paddle_graph.gen_model(save_dir) diff --git a/x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py b/x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py index 336f3e1..34aee01 100644 --- a/x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py +++ b/x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py @@ -284,7 +284,6 @@ class TFOpMapper(OpMapper): inputs["shape"] = dims.name layer_attrs["dtype"] = string(input_value.dtype) layer_attrs["fill_value"] = input_value.value - self.paddle_graph.add_layer( "paddle.full", @@ -578,6 +577,9 @@ class TFOpMapper(OpMapper): inputs={"x": node.name}, outputs=[node.name], perm=[0, 2, 3, 1]) + + def FusedBatchNormV3(self, node): + self.FusedBatchNorm(node) def Mean(self, node): input = self.graph.get_input_node(node, 0) @@ -930,6 +932,23 @@ class TFOpMapper(OpMapper): outputs=[node.name], axis=axis) + def Concat(self, node): + inputs_list = list() + for i in range(1, len(node.inputs)): + inputs_list.append(self.graph.get_input_node(node, i)) + axis = self.graph.get_input_node(node, 0) + assert axis.layer_type == "Const", "axis for ConcatV2 must be type Const" + axis = axis.value + if axis < 0: + axis += len(inputs_list[0].out_shapes[0]) + + input_names = [i.name for i in inputs_list] + self.paddle_graph.add_layer( + kernel="paddle.concat", + inputs={"x": input_names}, + outputs=[node.name], + axis=axis) + def AddN(self, node): inputs_list = list() for i in range(len(node.inputs) - 1): @@ -1400,6 +1419,7 @@ class TFOpMapper(OpMapper): inputs = {"x": x.name, "y": y.name} x_shape = x.out_shapes[0] y_shape = y.out_shapes[0] + # TODO(syf) layer_id = self.paddle_graph.add_layer( "fluid.layers.elementwise_sub", inputs=inputs, outputs=[node.name]) self.paddle_graph.layers[layer_id].input_shapes = {"x": x_shape, "y": y_shape} diff --git a/x2paddle/op_mapper/static/caffe2paddle/caffe_op_mapper.py b/x2paddle/op_mapper/static/caffe2paddle/caffe_op_mapper.py index e99e941..23dcc18 100644 --- a/x2paddle/op_mapper/static/caffe2paddle/caffe_op_mapper.py +++ b/x2paddle/op_mapper/static/caffe2paddle/caffe_op_mapper.py @@ -89,6 +89,7 @@ class CaffeOpMapper(OpMapper): input_shape.append(last_node.output_shape[idx]) node.input_shape = input_shape + func_name = 'shape_' + node.layer_type.lower() if is_fluid_op: node.output_shape = getattr(caffe_shape, func_name)(node.layer, @@ -974,4 +975,4 @@ class CaffeOpMapper(OpMapper): kernel=op_info, inputs={"x": self.get_input_name(input)}, outputs=[node.layer_name]) - + \ No newline at end of file diff --git a/x2paddle/op_mapper/static/tf2paddle/__pycache__/__init__.cpython-37.pyc b/x2paddle/op_mapper/static/tf2paddle/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a240985a6ff222bb2c8efbf8c0dc5015589629f4 GIT binary patch literal 175 zcmZ?b<>g`k0v^u`@gVv!h=2h`Aj1KOi&=m~3PUi1CZpdqnB|Nj2(o}r;)0)OTEzh2$(jYQ(xyzu@qIC%qp*87pD zgi1COE6Lg9N@_NharDHXvnss@GOXH!=gSAelZsI(76Ow$#Y%iF# zm6^E|OTu3oKX&;re%4VWD!Gy9C3?wAsr6JZWha;O=01gEFLfx<8sRaU*p*P}*W=Yg ziC#)&b|h?hzAJG)xg){1(A4ZqH~YkT^@(*ei9%mw;v}n6X(u<|Hdku4Q*PB(>eadS zYRj&hPTI0fJj}N{Ro-`uGc{A6WqAGRggJr|UV8MFm6m;rwc0vcYt7eM3;SPp%i9j< zKBFjA_pfeQJJ6A#xCJGy$QayW*)_W{cZ)smJ+kMk{?qBsS;ttYx1`c5P?uFkl1P@5 zMz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!+=RT*b1RTnBb$kZ0`*i8Pf 0).any(): -# out_shape[out_shape < 0] = 0 -# self.paddle_graph.add_layer( -# kernel="fluid.layers.reshape", -# inputs={"x": node.name}, -# outputs=[node.name], -# shape=out_shape.tolist()) - -# if input.dtype == 'bool': -# self.paddle_graph.add_layer( -# kernel="fluid.layers.cast", -# inputs={"x": node.name}, -# outputs=[node.name], -# dtype="'bool'") def Pad(self, node): input = self.graph.get_node(node.layer.input[0]) @@ -668,37 +624,33 @@ class TFOpMapper(OpMapper): new_padding = paddings[2:6] transpose_name = gen_name("pad", "transpose") self.paddle_graph.add_layer( - kernel="fluid.layers.transpose", + kernel="paddle.transpose", inputs={"x": input.name}, outputs=[transpose_name], perm=[0, 3, 1, 2]) self.paddle_graph.add_layer( - kernel="fluid.layers.pad2d", - inputs={"input": transpose_name}, + kernel="paddle.nn.functional.pad", + inputs={"x": transpose_name}, outputs=[node.name], - paddings=new_padding) + pad=new_padding) self.paddle_graph.add_layer( - kernel="fluid.layers.transpose", + kernel="paddle.transpose", inputs={"x": node.name}, outputs=[node.name], perm=[0, 2, 3, 1]) return self.paddle_graph.add_layer( - kernel="fluid.layers.pad", + kernel="paddle.nn.functional.pad", inputs={"x": input.name}, outputs=[node.name], - paddings=paddings) + pad=paddings) def MirrorPad(self, node): - op_name = name_generator("pad", self.nn_name2id) - output_name = node.name - layer_outputs = [op_name, output_name] input = self.graph.get_input_node(node, 0) paddings = self.graph.get_input_node(node, 1) assert paddings.layer_type == "Const", "Padding should be Const" paddings = np.flip(paddings.value, 0).flatten().tolist() - dim = int(len(paddings) / 2) transpose_name = gen_name("pad", "transpose") self.paddle_graph.add_layer( kernel="paddle.transpose", @@ -706,9 +658,9 @@ class TFOpMapper(OpMapper): outputs=[transpose_name], perm=[0, 3, 1, 2]) self.paddle_graph.add_layer( - kernel="paddle.nn.Pad{}D".format(dim), + kernel="paddle.nn.functional.pad".format(dim), inputs={"x": transpose_name}, - outputs=layer_outputs, + outputs=[node.name], pad=new_padding) self.paddle_graph.add_layer( kernel="paddle.transpose", @@ -717,22 +669,13 @@ class TFOpMapper(OpMapper): perm=[0, 2, 3, 1]) def Squeeze(self, node): - input = self.graph.get_node(node.layer.input[0]) + input = self.graph.get_input_node(node, 0) squeeze_dims = node.get_attr('squeeze_dims') self.paddle_graph.add_layer( - kernel="fluid.layers.squeeze", - inputs={"input": input.name}, - outputs=[node.name], - axes=squeeze_dims) - - def Softmax(self, node): - input = self.graph.get_node(node.layer.input[0]) - axis = node.get_attr("axis") - self.paddle_graph.add_layer( - kernel="fluid.layers.softmax", - inputs={"input": input.name}, + kernel="paddle.squeeze", + inputs={"x": input.name}, outputs=[node.name], - axis=axis) + axis=squeeze_dims) def Shape(self, node): input = self.graph.get_input_node(node, 0) @@ -762,12 +705,12 @@ class TFOpMapper(OpMapper): outputs=[node.name]) def ArgMax(self, node): - input = self.graph.get_node(node.layer.input[0]) - axis = self.graph.get_node(node.layer.input[1]) + input = self.graph.get_input_node(node, 0) + axis = self.graph.get_input_node(node, 1) assert axis.layer_type == "Const", "ArgMax only support Const parameter" axis = axis.value self.paddle_graph.add_layer( - kernel="fluid.layers.argmax", + kernel="paddle.argmax", inputs={"x": input.name}, outputs=[node.name], axis=axis) @@ -786,8 +729,8 @@ class TFOpMapper(OpMapper): sorted=sort) def MatMul(self, node): - x = self.graph.get_node(node.layer.input[0]) - y = self.graph.get_node(node.layer.input[1]) + x = self.graph.get_input_node(node, 0) + y = self.graph.get_input_node(node, 1) transpose_a = node.get_attr('transpose_a') transpose_b = node.get_attr('transpose_b') if transpose_a is None: @@ -795,7 +738,7 @@ class TFOpMapper(OpMapper): if transpose_b is None: transpose_b = node.get_attr('adj_y') self.paddle_graph.add_layer( - kernel="fluid.layers.matmul", + kernel="paddle.matmul", inputs={"x": x.name, "y": y.name}, outputs=[node.name], @@ -820,8 +763,11 @@ class TFOpMapper(OpMapper): data_format = node.get_attr("data_format").decode() pad_mode = node.get_attr("padding").decode() - self.params[kernel.layer_name.replace( - '/', '_')] = numpy.transpose(kernel.value, (2, 3, 0, 1)) + self.paddle_graph.add_layer( + kernel="paddle.transpose", + inputs={"x": kernel.name}, + outputs=[kernel.name], + perm=[2, 3, 0, 1]) input_name = input.name if data_format == "NHWC": @@ -830,34 +776,32 @@ class TFOpMapper(OpMapper): dilations = [dilations[i] for i in [0, 3, 1, 2]] transpose_name = gen_name('depthwise_conv2d', 'transpose') self.paddle_graph.add_layer( - kernel="fluid.layers.transpose", + kernel="paddle.transpose", inputs={"x": input.name}, outputs=[transpose_name], perm=[0, 3, 1, 2]) input_name = transpose_name self.paddle_graph.add_layer( - kernel="fluid.layers.conv2d", - inputs={"input": input_name}, + kernel="paddle.nn.functional.conv2d", + inputs={"x": input_name, + "weight": kernel.name}, outputs=[node.name], - num_filters=in_shape[1], - filter_size=k_size[0:2], stride=strides[2:4], dilation=dilations[2:4], groups=k_size[3] * in_shape[1], padding=string(pad_mode), - param_attr=string(kernel.layer_name), - bias_attr=False) + bias=None) if data_format == "NHWC": self.paddle_graph.add_layer( - kernel="fluid.layers.transpose", + kernel="paddle.transpose", inputs={"x": node.name}, outputs=[node.name], perm=[0, 2, 3, 1]) def AvgPool(self, node): - input = self.graph.get_node(node.layer.input[0]) + input = self.graph.get_input_node(node, 0) k_size = node.get_attr("ksize") strides = node.get_attr("strides") @@ -868,13 +812,15 @@ class TFOpMapper(OpMapper): if data_format == "NHWC": transpose_name = gen_name("avg_pool", "transpose") self.paddle_graph.add_layer( - kernel="fluid.layers.transpose", + kernel="paddle.transpose", inputs={"x": input.name}, outputs=[transpose_name], perm=[0, 3, 1, 2]) strides = [strides[i] for i in [0, 3, 1, 2]] k_size = [k_size[i] for i in [0, 3, 1, 2]] input_name = transpose_name + + # TODO(syf): The op has diff. self.paddle_graph.add_layer( kernel="fluid.layers.pool2d", @@ -887,29 +833,31 @@ class TFOpMapper(OpMapper): if data_format == "NHWC": self.paddle_graph.add_layer( - kernel="fluid.layers.transpose", + kernel="paddle.transpose", inputs={"x": node.name}, outputs=[node.name], perm=[0, 2, 3, 1]) def Pack(self, node): - inputs = [self.graph.get_node(name) for name in node.layer.input] - input_names = [i.name for i in inputs] + inputs_list = list() + for i in range(len(node.inputs)): + inputs_list.append(self.graph.get_input_node(node, i)) + input_names = [i.name for i in inputs_list] axis = node.get_attr("axis") self.paddle_graph.add_layer( - kernel="fluid.layers.stack", + kernel="paddle.stack", inputs={"x": input_names}, outputs=[node.name], axis=axis) if len(node.out_shapes[0]) == 1: self.paddle_graph.add_layer( - kernel="fluid.layers.reshape", + kernel="paddle.reshape", inputs={"x": node.name}, outputs=[node.name], shape=[-1]) def Unpack(self, node): - input = self.graph.get_node(node.layer.input[0]) + input = self.graph.get_input_node(node, 0) axis = node.get_attr("axis") num = node.get_attr("num") shape = input.out_shapes[0] @@ -917,10 +865,10 @@ class TFOpMapper(OpMapper): if len(shape) == 1: if shape[0] > 0 and num == shape[0]: self.paddle_graph.add_layer( - kernel="fluid.layers.unsqueeze", - inputs={"input": input.name}, + kernel="paddle.unsqueeze", + inputs={"x": input.name}, outputs=[node.name], - axes=[0]) + axis=[0]) input_name = node.name axis = 1 else: @@ -929,41 +877,45 @@ class TFOpMapper(OpMapper): if len(layer_outputs) == 1: layer_outputs[0] = "[{}]".format(node.layer_name) self.paddle_graph.add_layer( - kernel="fluid.layers.unstack", + kernel="paddle.unstack", inputs={"x": input_name}, outputs=layer_outputs, axis=axis, num=num) def ConcatV2(self, node): - inputs = [self.graph.get_node(name) for name in node.layer.input[:-1]] - axis = self.graph.get_node(node.layer.input[-1]) + inputs_list = list() + for i in range(len(node.inputs) - 1): + inputs_list.append(self.graph.get_input_node(node, i)) + axis = self.graph.get_input_node(node, -1) assert axis.layer_type == "Const", "axis for ConcatV2 must be type Const" axis = axis.value if axis < 0: - axis += len(inputs[0].out_shapes[0]) + axis += len(inputs_list[0].out_shapes[0]) - input_names = [i.name for i in inputs] - for i, ipt in enumerate(inputs): - if ipt.dtype == 'bool': - cast_name = gen_name('concat', 'cast') - self.paddle_graph.add_layer( - kernel="fluid.layers.cast", - inputs={"x": ipt.name}, - outputs=[cast_name], - dtype="'int32'") - input_names[i] = cast_name + input_names = [i.name for i in inputs_list] self.paddle_graph.add_layer( - kernel="fluid.layers.concat", - inputs={"input": input_names}, + kernel="paddle.concat", + inputs={"x": input_names}, + outputs=[node.name], + axis=axis) + + def Concat(self, node): + inputs_list = list() + for i in range(1, len(node.inputs)): + inputs_list.append(self.graph.get_input_node(node, i)) + axis = self.graph.get_input_node(node, 0) + assert axis.layer_type == "Const", "axis for ConcatV2 must be type Const" + axis = axis.value + if axis < 0: + axis += len(inputs_list[0].out_shapes[0]) + + input_names = [i.name for i in inputs_list] + self.paddle_graph.add_layer( + kernel="paddle.concat", + inputs={"x": input_names}, outputs=[node.name], axis=axis) - if node.dtype == 'bool': - self.paddle_graph.add_layer( - kernel="fluid.layers.cast", - inputs={"x": node.name}, - outputs=[node.name], - dtype="'bool'") def AddN(self, node): inputs_list = list() @@ -977,10 +929,10 @@ class TFOpMapper(OpMapper): outputs=[node.name]) def StridedSlice(self, node): - input = self.graph.get_node(node.layer.input[0]) - begin = self.graph.get_node(node.layer.input[1]) - end = self.graph.get_node(node.layer.input[2]) - strides = self.graph.get_node(node.layer.input[3]) + input = self.graph.get_input_node(node, 0) + begin = self.graph.get_input_node(node, 1) + end = self.graph.get_input_node(node, 2) + strides = self.graph.get_input_node(node, 3) if strides.layer_type == "Const": strides = strides.value.tolist() @@ -1042,29 +994,44 @@ class TFOpMapper(OpMapper): new_end.append(999999) else: new_end.append(end[i]) + + if input.dtype == "bool": + self.paddle_graph.add_layer( + "paddle.cast", + inputs={"x": input.name}, + outputs=[input.name], + dtype=string("int32")) self.paddle_graph.add_layer( - kernel="fluid.layers.slice", + kernel="paddle.slice", inputs={"input": input.name}, outputs=[node.name], axes=[i for i in range(len(new_begin))], starts=new_begin, ends=new_end) + + if input.dtype == "bool": + self.paddle_graph.add_layer( + "paddle.cast", + inputs={"x": node.name}, + outputs=[node.name], + dtype=string("bool")) + if len(new_axes) > 0: self.paddle_graph.add_layer( - kernel="fluid.layers.unsqueeze", - inputs={"input": node.name}, + kernel="paddle.unsqueeze", + inputs={"x": node.name}, outputs=[node.name], - axes=new_axes) + axis=new_axes) if len(shrink_axes) > 0: if len(input.out_shapes[0]) + len(new_axes) <= 1: pass else: self.paddle_graph.add_layer( - kernel="fluid.layers.squeeze", - inputs={"input": node.name}, + kernel="paddle.squeeze", + inputs={"x": node.name}, outputs=[node.name], - axes=shrink_axes) + axis=shrink_axes) def Prod(self, node): input = self.graph.get_input_node(node, 0) @@ -1081,25 +1048,25 @@ class TFOpMapper(OpMapper): axis=axis) def Split(self, node): - dim = self.graph.get_node(node.layer.input[0]) - input = self.graph.get_node(node.layer.input[1]) + dim = self.graph.get_input_node(node, 0) + input = self.graph.get_input_node(node, 1) assert dim.layer_type == "Const" num_split = node.get_attr('num_split') dim = dim.value self.paddle_graph.add_layer( - kernel="fluid.layers.split", - inputs={"input": input.name}, + kernel="paddle.split", + inputs={"x": input.name}, outputs=[ "{}_p{}".format(node.layer_name, i) for i in range(num_split) ], num_or_sections=num_split, - dim=dim) + axis=dim) def Slice(self, node): - input = self.graph.get_node(node.layer.input[0]) - begin = self.graph.get_node(node.layer.input[1]) - size = self.graph.get_node(node.layer.input[2]) + input = self.graph.get_input_node(node, 0) + begin = self.graph.get_input_node(node, 1) + size = self.graph.get_input_node(node, 2) inputs = {"x": input.name} attrs = {} @@ -1124,143 +1091,147 @@ class TFOpMapper(OpMapper): shape = size.out_shapes[0] reshape_name = gen_name("slice", "reshape") self.paddle_graph.add_layer( - kernel="fluid.layers.reshape", + kernel="paddle.reshape", inputs={"x": size.name}, outputs=[reshape_name], shape=shape) inputs['shape'] = reshape_name self.paddle_graph.add_layer( - kernel="fluid.layers.crop_tensor", + kernel="paddle.crop", inputs=inputs, outputs=[node.name], **attrs) def ResizeNearestNeighbor(self, node): - input = self.graph.get_node(node.layer.input[0]) - resize_shape = self.graph.get_node(node.layer.input[1]) + input = self.graph.get_input_node(node, 0) + resize_shape = self.graph.get_input_node(node, 1) data_format = "NHWC" - inputs = {"input": input.name} - attrs = {"align_corners": node.get_attr("align_corners")} + inputs = {"x": input.name} + attrs = {"align_corners": node.get_attr("align_corners"), + "mode": string("nearest"), + "align_mode": 1} if resize_shape.layer_type == "Const": resize_shape = resize_shape.value.tolist() - attrs["out_shape"] = resize_shape + attrs["size"] = resize_shape else: shape = resize_shape.out_shapes[0] reshape_name = gen_name("resize_nearest", "reshape") self.paddle_graph.add_layer( - kernel="fluid.layers.reshape", + kernel="paddle.reshape", inputs={"x": resize_shape.name}, outputs=[reshape_name], shape=shape) - inputs["out_shape"] = reshape_name + inputs["size"] = reshape_name if data_format == "NHWC": transpose_name = gen_name("resize_nearest", "reshape") self.paddle_graph.add_layer( - kernel="fluid.layers.transpose", + kernel="paddle.transpose", inputs={"x": input.name}, outputs=[transpose_name], perm=[0, 3, 1, 2]) - inputs["input"] = transpose_name + inputs["x"] = transpose_name self.paddle_graph.add_layer( - kernel="fluid.layers.resize_nearest", + kernel="paddle.nn.functional.interpolate", inputs=inputs, outputs=[node.name], **attrs) if data_format == "NHWC": self.paddle_graph.add_layer( - kernel="fluid.layers.transpose", + kernel="paddle.transpose", inputs={"x": node.name}, outputs=[node.name], perm=[0, 2, 3, 1]) def ResizeBilinear(self, node): - input = self.graph.get_node(node.layer.input[0]) - resize_shape = self.graph.get_node(node.layer.input[1]) + input = self.graph.get_input_node(node, 0) + resize_shape = self.graph.get_input_node(node, 1) data_format = "NHWC" - inputs = {"input": input.name} - attrs = {"align_corners": node.get_attr("align_corners")} + inputs = {"x": input.name} + attrs = {"align_corners": node.get_attr("align_corners"), + "mode": string("bilinear"), + "align_mode": 1} if resize_shape.layer_type == "Const": resize_shape = resize_shape.value.tolist() - attrs["out_shape"] = resize_shape + attrs["size"] = resize_shape else: shape = resize_shape.out_shapes[0] reshape_name = gen_name("resize_bilinear", "reshape") self.paddle_graph.add_layer( - kernel="fluid.layers.reshape", + kernel="paddle.reshape", inputs={"x": resize_shape.name}, outputs=[reshape_name], shape=shape) - inputs["out_shape"] = reshape_name + inputs["size"] = reshape_name if data_format == "NHWC": transpose_name = gen_name("resize_bilinear", "reshape") self.paddle_graph.add_layer( - kernel="fluid.layers.transpose", + kernel="paddle.transpose", inputs={"x": input.name}, outputs=[transpose_name], perm=[0, 3, 1, 2]) - inputs["input"] = transpose_name + inputs["x"] = transpose_name self.paddle_graph.add_layer( - kernel="fluid.layers.resize_bilinear", + kernel="paddle.nn.functional.interpolate", inputs=inputs, outputs=[node.name], **attrs) if data_format == "NHWC": self.paddle_graph.add_layer( - kernel="fluid.layers.transpose", + kernel="paddle.transpose", inputs={"x": node.name}, outputs=[node.name], perm=[0, 2, 3, 1]) def Cast(self, node): - input = self.graph.get_node(node.layer.input[0]) + input = self.graph.get_input_node(node, 0) dtype = node.dtype self.paddle_graph.add_layer( - kernel="fluid.layers.cast", + kernel="paddle.cast", inputs={"x": input.name}, outputs=[node.name], dtype=string(dtype)) def Sum(self, node): - input = self.graph.get_node(node.layer.input[0]) - reduce_idx = self.graph.get_node(node.layer.input[1]) + input = self.graph.get_input_node(node, 0) + reduce_idx = self.graph.get_input_node(node, 1) assert reduce_idx.layer_type == "Const", "Only support Const parameter[reduce_idx]" keep_dims = node.get_attr("keep_dims") dim = reduce_idx.value.tolist() self.paddle_graph.add_layer( - kernel="fluid.layers.reduce_sum", - inputs={"input": input.name}, + kernel="paddle.sum", + inputs={"x": input.name}, outputs=[node.name], - dim=dim, - keep_dim=keep_dims) + axis=dim, + keepdim=keep_dims) def Max(self, node): - input = self.graph.get_node(node.layer.input[0]) - reduce_idx = self.graph.get_node(node.layer.input[1]) + input = self.graph.get_input_node(node, 0) + reduce_idx = self.graph.get_input_node(node, 1) assert reduce_idx.layer_type == "Const", "Only support Const parameter[reduce_idx]" keep_dims = node.get_attr("keep_dims") dim = reduce_idx.value.tolist() self.paddle_graph.add_layer( - kernel="fluid.layers.reduce_max", - inputs={"input": input.name}, + kernel="paddle.max", + inputs={"x": input.name}, outputs=[node.name], - dim=dim, - keep_dim=keep_dims) + axis=dim, + keepdim=keep_dims) def RandomUniform(self, node): - shape = self.graph.get_node(node.layer.input[0]) + shape = self.graph.get_input_node(node, 0) if shape.layer_type == "Const": shape = shape.value.tolist() self.paddle_graph.add_layer( - kernel="fluid.layers.uniform_random", + kernel="paddle.uniform", inputs={}, outputs=[node.name], shape=shape, @@ -1268,16 +1239,16 @@ class TFOpMapper(OpMapper): max=0.9999) else: self.paddle_graph.add_layer( - kernel="fluid.layers.uniform_random", + kernel="paddle.uniform", inputs={'shape': shape.name}, outputs=[node.name], min=0.0, max=0.9999) def Conv2DBackpropInput(self, node): - out_shape = self.graph.get_node(node.layer.input[0]) - kernel = self.graph.get_node(node.layer.input[1]) - input = self.graph.get_node(node.layer.input[2]) + out_shape = self.graph.get_input_node(node, 0) + kernel = self.graph.get_input_node(node, 1) + input = self.graph.get_input_node(node, 2) assert kernel.layer_type == "Const", "Kernel of Conv2DBackpropInput should be Const" @@ -1292,15 +1263,15 @@ class TFOpMapper(OpMapper): in_shape = self.decoder.infer_tensor(input, use_diff_inputs=False).shape k_size = kernel.out_shapes[0] if k_size.count(-1) > 2: - k_size = self.decoder.infer_tensor(input, use_diff_inputs=False).shape + k_size = self.decoder.infer_tensor(kernel, use_diff_inputs=False).shape pad_mode = node.get_attr("padding").decode() strides = node.get_attr("strides") dilations = node.get_attr("dilations") data_format = node.get_attr("data_format").decode() - self.params[kernel.layer_name.replace( - '/', '_')] = numpy.transpose(kernel.value, (3, 2, 0, 1)) + kernel_name = node.name + ".weight" + self.params[kernel_name] = numpy.transpose(kernel.value, (3, 2, 0, 1)) input_name = input.name if data_format == "NHWC": @@ -1309,20 +1280,26 @@ class TFOpMapper(OpMapper): dilations = [dilations[i] for i in [0, 3, 1, 2]] transpose_name = gen_name("conv2dbackpropinput", "transpose") self.paddle_graph.add_layer( - kernel="fluid.layers.transpose", + kernel="paddle.transpose", inputs={"x": input.name}, outputs=[transpose_name], perm=[0, 3, 1, 2]) input_name = transpose_name self.paddle_graph.add_layer( - kernel="fluid.layers.conv2d_transpose", - inputs={"input": input_name}, + kernel="paddle.static.create_parameter", + inputs={}, + outputs=["{}_{}".format(node.name, kernel_name).replace(".", "_")], + dtype=string(str(self.params[kernel_name].dtype)), + shape=self.params[kernel_name].shape, + name=string(kernel_name)) + + self.paddle_graph.add_layer( + kernel="paddle.nn.functional.conv2d_transpose", + inputs={"x": input_name, + "weight": "{}_{}".format(node.name, kernel_name).replace(".", "_")}, outputs=[node.name], - bias_attr=False, - param_attr=string(kernel.layer_name), - num_filters=k_size[2], - filter_size=k_size[0:2], + bias=None, stride=strides[2:4], dilation=dilations[2:4], padding=string(pad_mode), @@ -1330,7 +1307,7 @@ class TFOpMapper(OpMapper): if data_format == "NHWC": self.paddle_graph.add_layer( - kernel="fluid.layers.transpose", + kernel="paddle.transpose", inputs={"x": node.name}, outputs=[node.name], perm=[0, 2, 3, 1]) @@ -1403,11 +1380,12 @@ class TFOpMapper(OpMapper): shape=node.out_shapes[0]) def SquaredDifference(self, node): - x = self.graph.get_node(node.layer.input[0]) - y = self.graph.get_node(node.layer.input[1]) + x = self.graph.get_input_node(node, 0) + y = self.graph.get_input_node(node, 1) inputs = {"x": x.name, "y": y.name} x_shape = x.out_shapes[0] y_shape = y.out_shapes[0] + # TODO(syf) layer_id = self.paddle_graph.add_layer( "fluid.layers.elementwise_sub", inputs=inputs, outputs=[node.name]) self.paddle_graph.layers[layer_id].input_shapes = {"x": x_shape, "y": y_shape} @@ -1416,14 +1394,14 @@ class TFOpMapper(OpMapper): x_shape = node.out_shapes[0] y_shape = node.out_shapes[0] layer_id = self.paddle_graph.add_layer( - "fluid.layers.elementwise_mul", inputs=inputs, outputs=[node.name]) + "paddle.multiply", inputs=inputs, outputs=[node.name]) self.paddle_graph.layers[layer_id].input_shapes = {"x": x_shape, "y": y_shape} def OneHot(self, node): - input = self.graph.get_node(node.layer.input[0]) - depth = self.graph.get_node(node.layer.input[1]) - on_value = self.graph.get_node(node.layer.input[2]) - off_value = self.graph.get_node(node.layer.input[3]) + input = self.graph.get_input_node(node, 0) + depth = self.graph.get_input_node(node, 1) + on_value = self.graph.get_input_node(node, 2) + off_value = self.graph.get_input_node(node, 3) assert depth.layer_type == 'Const', 'Parameter depth should be Const in OneHot' assert on_value.layer_type == 'Const', 'Parameter on_value should be Const in OneHot' assert off_value.layer_type == 'Const', 'Parameter off_value should be Const in OneHot' @@ -1437,73 +1415,72 @@ class TFOpMapper(OpMapper): 0.0) < 1e-06, "off_value should be 0 in OneHot" self.paddle_graph.add_layer( - "fluid.one_hot", - inputs={"input": input.name}, + "paddle.nn.functional.one_hot", + inputs={"x": input.name}, outputs=[node.name], - depth=depth.value) + num_classes=depth.value) def Pow(self, node): - x = self.graph.get_node(node.layer.input[0]) - factor = self.graph.get_node(node.layer.input[1]) + x = self.graph.get_input_node(node, 0) + factor = self.graph.get_input_node(node, 1) inputs = {"x": x.name} attr = dict() if factor.layer_type == 'Const': - attr["factor"] = factor.value.tolist() + attr["y"] = factor.value.tolist() else: - inputs["factor"] = factor.name + inputs["y"] = factor.name self.paddle_graph.add_layer( - "fluid.layers.pow", inputs=inputs, outputs=[node.name], **attr) + "paddle.pow", inputs=inputs, outputs=[node.name], **attr) def All(self, node): - input = self.graph.get_node(node.layer.input[0]) - reduce_idx = self.graph.get_node(node.layer.input[1]) + input = self.graph.get_input_node(node, 0) + reduce_idx = self.graph.get_input_node(node, 1) assert reduce_idx.layer_type == "Const", "Only support Const parameter[reduce_idx]" attr = dict() - attr["dim"] = reduce_idx.value.tolist() - attr["keep_dim"] = node.get_attr("keep_dims") + attr["axis"] = reduce_idx.value.tolist() + attr["keepdim"] = node.get_attr("keep_dims") input_name = input.name if input.dtype != "bool": input_name = gen_name("all", "cast") self.paddle_graph.add_layer( - "fluid.layers.cast", + "paddle.cast", inputs={"x": input.name}, outputs=[input_name], dtype=string("bool")) self.paddle_graph.add_layer( - "fluid.layers.reduce_all", - inputs={"input": input_name}, + "paddle.all", + inputs={"x": input_name}, outputs=[node.name], **attr) node.layer.attr['dtype'].type = 10 def GatherV2(self, node): - embeddings = self.graph.get_node(node.layer.input[0]) - index = self.graph.get_node(node.layer.input[1]) - axis = self.graph.get_node(node.layer.input[2]) + embeddings = self.graph.get_input_node(node, 0) + index = self.graph.get_input_node(node, 1) + axis = self.graph.get_input_node(node, 2) assert axis.layer_type == 'Const', "Only support Const parameter[axis]" axis = axis.value - assert axis == 0, "Only support axis=0 in GatherV2 OP" index_name = index.name if len(index.out_shapes[0]) != 1: reshape_name = gen_name("gather", "reshape") index_name = reshape_name self.paddle_graph.add_layer( - "fluid.layers.reshape", + "paddle.reshape", inputs={"x": index.name}, outputs=[reshape_name], shape=[-1]) - inputs = {'input': embeddings.name, 'index': index_name} + inputs = {'x': embeddings.name, 'index': index_name} self.paddle_graph.add_layer( - "fluid.layers.gather", + "paddle.gather", inputs=inputs, outputs=[node.name], - overwrite=False) + axis=axis) if len(index.out_shapes[0]) != 1: out_shape = node.out_shapes[0] self.paddle_graph.add_layer( - kernel="fluid.layers.reshape", + kernel="paddle.reshape", inputs={"x": node.name}, outputs=[node.name], shape=out_shape) @@ -1518,19 +1495,19 @@ class TFOpMapper(OpMapper): outputs=[node.name]) def ExpandDims(self, node): - x = self.graph.get_node(node.layer.input[0], copy=True) - y = self.graph.get_node(node.layer.input[1], copy=True) - inputs = {"input": x.name} + x = self.graph.get_input_node(node, 0, copy=True) + y = self.graph.get_input_node(node, 1, copy=True) + inputs = {"x": x.name} attr = dict() if y.layer_type == 'Const': dim = y.value.tolist() if not isinstance(dim, list): dim = [dim] - attr['axes'] = dim + attr['axis'] = dim else: - inputs['axes'] = y.name + inputs['axis'] = y.name self.paddle_graph.add_layer( - "fluid.layers.unsqueeze", + "paddle.unsqueeze", inputs=inputs, outputs=[node.name], **attr) diff --git a/x2paddle/optimizer/__pycache__/__init__.cpython-37.pyc b/x2paddle/optimizer/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ae36ed5ccada2562a2e52dc61d5b1ce0d6468d61 GIT binary patch literal 158 zcmZ?b<>g`kf(Kp~;z9Id5CH>>K!yVl7qb9~6oz01O-8?!3`HPe1o6vVKR2&LzqmB7 zGBGbLF)!V~P(Q*bATcE+CpA7fKP45;)2}cp01NBq7nEe?W>%#Z>Bq-s=4F<|$LkeT U-r}&y%}*)KNwou6@EM3100t5#wg3PC literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/__pycache__/optimizer.cpython-37.pyc b/x2paddle/optimizer/__pycache__/optimizer.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..943baaeec7d01fb960e1d5cc3a8f0b6339d8e4c8 GIT binary patch literal 1897 zcmahK%Wm8@kko6n@;XkO#CF~0;X?v!QS3TC^wOdT+5#y8)HP58DFg%rSESZ*w3JM7 zQ?D!cVxM~GH#o=sP0u_P=&8TZQ-{)OEhjcgfy3d*eJD!T9UtpXApig#I?0 zW;lR6hglfF5W^{&;1FYjTdB2Qul9U(=BvApULa;O=NvJIduMjoVeXHp@BIT>P#^21 zJz5msQ$fdE!WMrT8AdZ~K%T=a9s=Mf#0-TN^DBiow3*Aia}+wP11h`v)(c7VgCBC0 zOp+5Wb%)KyhN4|1X~ZKFf*EG*!2AYg@jHMLGyKMq+ojDcST~tH#w8-?=r`sV8>|C1 zyDS)Y3{`|6zXWporNw%%zGTY_`CBz6J_nf<;GNH96uZstuvK<6(Za(TxNtBAQ-N0pY47A|JA}rQ-0D#yBMAEx1KlJNAbSSH)zJ zotA&=4L_GWowgVoPy#GJ-@&I^lXLhqxhaYL;{DA1128{y=gC();gs!--JCVk%}-#8iy8 zpACQ7*{e@P8RLuH@OYiUv zdf?1g`(*uU;|>~~k!AG3FkN8oMb)tqkmIyOhv-}MdUR?jd|{Q=JA8&t?b5oi8GeW5 zptLWX5-^O!;P^A;miW*+!>7(AeL-_er*xrLxA)M|_A8`1%)0O^jd1$Ne+BOYbfvu; zuDn6FG{?WI}vW}0iC3s(G`D0qNqo~JWyr(6J+&bTbJn@i|F z?ZwcZRP{XxFD}w<^Q; zfN&4K0QVs6LG}6A!>jm%q&Fvb`&QM1)zi~=O@)mggy?{fNyesdtBCFqax|rB&5?J& zj@&fBT(1@|PD%6L-iKKj1g^%Din81H!$-~a8Z_4BpbB?V{}HNuhFjN2!9$p2VleO4 z@bS$ebti>SuaRgPxvlBR|H#$qw3m$zd8DdHTJcul*OmCP&ed0jRG7=rs~W>Jz<)d% BHq`(C literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/__pycache__/pass_.cpython-37.pyc b/x2paddle/optimizer/__pycache__/pass_.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..db9980479f15f039c9ff4fbef3fedbebca9eea85 GIT binary patch literal 746 zcmZuv&1&2*5SC=`M%iYekPzt2J(YzLw>g&*+LY29OrSj!QxJ}&-F2{KSCXN-^wiy# z>D%P2Qz4JgTTh+QW;dloFh80Z&wTUAZ^q*hf%EI)Mtq3~xy8%&#NeEP*dtKyi6oM) zK@?d_83WQ0}eCispNgL!W&g zUl!K-xC33%yN+m4-hx;JBMH>f>?bH6TUAdDjtuJ0dD>`~+FmaTJuUR?#mn^b>182h ztwh;MwY#O?PP-6J+s;)@wNxg>vErm#crHYxD<{Mu&SannU5*jk$u?7lC?wFL1b7GF zI3Q<5f56%RlV!_ipXMqlx~^U%(_WXZYIV}|)+JXeshX}Dq2tQ2W5Q@K(>kWxWp)MK)HY#iTe|tVtPGJ7Y zZUVa_Vw=e(9Qnc`A^b>)rj^Hv(9?Vr)% sIdMIM@BSFXa!{Pcj7K~Q(QLx}u)Vrgr3?3mKKK092Fz>h@f(Ev1z0Pj*#H0l literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/__pycache__/pass_manager.cpython-37.pyc b/x2paddle/optimizer/__pycache__/pass_manager.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f563960ed75fe7f3b1f4acd207c54015e8d22cfd GIT binary patch literal 1106 zcmZuwOKTKC5bo}I?CfL~j06)!FyO_#WHsj?Asz(9CE!K&(u~ucb&`46(~D+VLEOc& zS8v&yUOf9VJkLo8lK^1uBz_(>Z_WgPRA!8zn}f$KW#!T@vsy)lS5eL zUD%!yK?I$_l4NQPs9?gHkpUC-OVV{Bh**gQ+99m+2sTL|7USr^lJ=AgoW)I7wuCL5 z8JW_72f8a-MsI`eiMG*w;lt}2)y8pHmM_9A97;911+VTFV7U4*zxwj|&)094A3yoK zAQ1%@3Vv}tfmLD|g1|ep{~flxf=s1nXQuPoAPitg*#d+m%9%r%Ud>d0^5<?AIA4avn6vTPv0yEP0aN@S?+!MUb{ zjW?UwjrYIitrkv4gi15Z~$sY4w{snln!v&d>4^-0&Hi2oFGYT_e1{zx64W%|!m{$xA z7z!&&%4^B#V4Jv-Lui~-4-gJgNvKBys_@_H!=rBg`cy)-IBdpvT|t$1P;>U!RE4;2 GZ2tq(oa~nX literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/__pycache__/pattern_matcher.cpython-37.pyc b/x2paddle/optimizer/__pycache__/pattern_matcher.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..28555fc6843a32595578a01042e59eb62d7833af GIT binary patch literal 7474 zcmb7JU2GiJb)Ns3T`s95MTwN^x`YELS|?fAidws_;3_JiI8MT-umKm_7@H+$DDQH) zySy{2tcck}7HxAGTN0Dlv17{t8N{|?#ED^~iXwuIB1bDX#8mOL|6k4cB~1$rxz2TpR5+x0|l>h?0tJW44k~qk)q-*DZRV z6}ie2Gt}1p>8KpTj0xnSlAPt0gojDGZ{=O6I+BPc>ORI*B-E-83xu7cU>R7#KRid-Nvig`bX z?0H_uPic|id&OBn?D(M~9K8N(>d<^CIOJDLXL6<4TD3z7Ew6 zSNPb6%9S8LpI`LEq1HZGxq(Pm&O}Z&n=j>qY<85Wq@5Ji(ig{eo+;fP6&XRfQl25k z(U0Er@DY!o5`ukmnivh0H5_*x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h+2S>iXYd zBIAox{5`EOG@BQG(6KJ!bJWwvYO=_~#A>P_rOu9k5L5!f6;~IN9mcoQ$Rr8$qwA!t zSt`DQO54pMEoq3!wp`RE$)$qb6EMmY7jQbYpd)ND)+~7`gfV#9!v^_fV<51im1V z{P=~s2G^#^*sUG6L1+;ZL1>Ly5q$=woH=c8QjAh)MKP#Z$-9Et?d_o%BH`0@f*#juQY#ht$F?V=EZZHFT8!r^{@&p-Z@*W=H0Y=hV4jt8m1^6 zl(VOEBA=TsA~SY6SFCzS(2<_`|GZ7i+Wv3k^QKY*x6>qxC{#WzC z6H;9WXR$@!k)a?Z5|2>9nnU=VBchgyGv?{nr+>ttgLMCFvh}VeC0U=4{?QiqbmX8{ zp*wi01*>dvj5hoX700RQA}A6vK|A&A&T`1%!o%oD5DC--Z(+m-;t4^mK$y{<+xkg1 n(~(u4F5nL>23a!oLbGnSN#q=rIPXCUa(JhNp8UGvIeY#WFm$o} literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/code_optimizer/hierachical_tree.py b/x2paddle/optimizer/code_optimizer/hierachical_tree.py index 774bad6..c2aa31b 100644 --- a/x2paddle/optimizer/code_optimizer/hierachical_tree.py +++ b/x2paddle/optimizer/code_optimizer/hierachical_tree.py @@ -201,6 +201,7 @@ class HierarchicalTree(Tree): code_str = gen_layer_code(self.pd_graph, sub_layers, module_name, different_attrs=diff_attrs_column) +# print(code_str) self.codes.append(code_str) for sub_layers in sub_layers_list: inputs, outputs = get_inputs_outputs(self.pd_graph, sub_layers) @@ -358,7 +359,7 @@ class HierarchicalTree(Tree): run_func_list.append(" # {}: 形状为{},类型为{}。".format(k, v[0], v[1])) run_func_list.extend( [" paddle.disable_static()", - " params = paddle.load('{}/model.pdparams')".format(osp.abspath(save_dir)), + " params, _ = fluid.load_dygraph('{}/model')".format(save_dir), " model = {}()".format(self.pd_graph.name), " model.set_dict(params)", " model.eval()", @@ -370,12 +371,7 @@ class HierarchicalTree(Tree): self.update_parameters() import_list = ["import paddle", "import paddle.fluid as fluid", - "from paddle.fluid.initializer import Constant", - "from paddle.fluid.param_attr import ParamAttr", - "import math", - "from x2paddle.op_mapper.dygraph.pytorch2paddle " + \ - "import pytorch_custom_layer as x2paddle_nn" - "\n",] + "",] import_str = "\n".join(import_list) if not osp.exists(save_dir): os.makedirs(save_dir) diff --git a/x2paddle/optimizer/code_optimizer/layer_code_generator.py b/x2paddle/optimizer/code_optimizer/layer_code_generator.py index 3861eb4..37fdc9b 100644 --- a/x2paddle/optimizer/code_optimizer/layer_code_generator.py +++ b/x2paddle/optimizer/code_optimizer/layer_code_generator.py @@ -29,9 +29,9 @@ NN_KERNEL_NAME = {"paddle.nn.BatchNorm": "bn", "paddle.nn.Tanh": "tanh", "paddle.nn.AvgPool2D": "pool", "paddle.nn.MaxPool2D": "pool", - "paddle.nn.Pad1D": "pad", - "paddle.nn.Pad2D": "pad", - "paddle.nn.Pad3D": "pad", + "paddle.nn.Pad1d": "pad", + "paddle.nn.Pad2d": "pad", + "paddle.nn.Pad3d": "pad", "paddle.nn.Dropout": "dropout", "paddle.nn.GELU": "gelu", "paddle.nn.Hardtanh": "tanh", @@ -175,11 +175,9 @@ def gen_layer_code(graph, sub_layers, sub_layers_name, different_attrs=list()): if layer.kernel.startswith("paddle.nn") and index == 0: continue if not output_name.startswith("x") or output_name in outputs \ - or layer.kernel == "prim.assert": + or layer.kernel == "prim.assert" or \ + layer.kernel == "prim.if" or layer.kernel == "prim.loop": continue - elif layer.kernel == "prim.if" or layer.kernel == "prim.loop": - if index != 0: - outputs.append(output_name) elif output_name not in outputs: outputs.append(output_name) continue @@ -189,22 +187,15 @@ def gen_layer_code(graph, sub_layers, sub_layers_name, different_attrs=list()): if layer.kernel.startswith("paddle.nn") and index == 0 and "functional" not in layer.kernel: continue if not output_name.startswith("x") or output_name in outputs \ - or layer.kernel == "prim.assert": + or layer.kernel == "prim.assert" or \ + layer.kernel == "prim.if" or layer.kernel == "prim.loop": continue - elif layer.kernel == "prim.if" or layer.kernel == "prim.loop": - if index != 0: - outputs.append(output_name) else: outputs.append(output_name) no_output_count = 0 for i, (layer_id, layer) in enumerate(sub_layers.items()): - if ("paddle.nn" in layer.kernel and "functional" not in layer.kernel) or \ - layer.kernel.startswith("custom_layer"): - line = "self.{}".format(layer.outputs[0]) - if layer.kernel.startswith("custom_layer"): - line += "= x2paddle_nn.{}(".format(layer.kernel.split(":")[-1]) - else: - line += " = {}(".format(layer.kernel) + if ("paddle.nn" in layer.kernel and "functional" not in layer.kernel): + line = "self.{} = {}(".format(layer.outputs[0], layer.kernel) for k, v in layer.attrs.items(): key_name = "{}_{}".format(layer.outputs[0], k) if key_name in different_attrs: @@ -298,10 +289,7 @@ def gen_layer_code(graph, sub_layers, sub_layers_name, different_attrs=list()): else: if v not in cur_outputs and v not in inputs: inputs.append(v) - if k == "args": - line += v - else: - line += "{}={}, ".format(k, v) + line += "{}={}, ".format(k, v) for k, v in layer.attrs.items(): key_name = "{}_{}".format(layer.outputs[0], k) if key_name in different_attrs: diff --git a/x2paddle/optimizer/code_optimizer/subgraphs_union.py b/x2paddle/optimizer/code_optimizer/subgraphs_union.py index 5f16e66..a1bde6e 100644 --- a/x2paddle/optimizer/code_optimizer/subgraphs_union.py +++ b/x2paddle/optimizer/code_optimizer/subgraphs_union.py @@ -50,25 +50,21 @@ def get_inputs_outputs(pd_graph, layers): for layer_id, layer in layers.items(): # 获取输出节点名字 if layer_id not in pd_graph.edges_out: - for index, output_name in enumerate(layer.outputs): + for output_name in layer.outputs: if not output_name.startswith("x") or output_name in outputs \ - or layer.kernel == "prim.assert": + or layer.kernel == "prim.assert" or \ + layer.kernel == "prim.if" or layer.kernel == "prim.loop": continue - elif layer.kernel == "prim.if" or layer.kernel == "prim.loop": - if index != 0: - outputs.append(output_name) elif output_name not in outputs: outputs.append(output_name) else: for out_layer_id in pd_graph.edges_out[layer_id]: if out_layer_id not in layer_ids: - for index, output_name in enumerate(layer.outputs): + for output_name in layer.outputs: if not output_name.startswith("x") or output_name in outputs \ - or layer.kernel == "prim.assert": + or layer.kernel == "prim.assert" or \ + layer.kernel == "prim.if" or layer.kernel == "prim.loop": continue - elif layer.kernel == "prim.if" or layer.kernel == "prim.loop": - if index != 0: - outputs.append(output_name) else: outputs.append(output_name) # 获取输入节点名字 diff --git a/x2paddle/optimizer/elimination/__pycache__/__init__.cpython-37.pyc b/x2paddle/optimizer/elimination/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3cb420c5c56adbd9f844046dee3b74ccbff7d69d GIT binary patch literal 170 zcmZ?b<>g`kf(Kp~;z9Id5CH>>K!yVl7qb9~6oz01O-8?!3`HPe1o10aKR2&LzqmB7 zGBGbLF)!V~P(Q*bATcE+CpA7fKP45;)2}cp01NBq7nEe?W>%#Z>8IuZ8F`5%nfZD8 f@$s2?nI-Y@dIgoYIBatBQ%ZAE?Ld}&24V&PDZea= literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/elimination/dygraph/__pycache__/__init__.cpython-37.pyc b/x2paddle/optimizer/elimination/dygraph/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..877c1690d02becbbe2201dda9a4cc91b12b63c35 GIT binary patch literal 329 zcmZ?b<>g`kf(Kp~;-4`wFgylvU;xNxZ~)?B86c6ukiwY5kjogw$OvLH>N;Da7NxM|07bO;CgcK#_6&K_er@H23=4R$4mSpDV0i|VeNv8%R78mW<0a#c+zn}!@)T-1XeI$$ZQy~7)kB`sH%PfhH*DI*J W#bJ}1pHiBWYR3<>uNdSs9!3BQE@L(T literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/elimination/dygraph/__pycache__/transpose_eliminate_pass.cpython-37.pyc b/x2paddle/optimizer/elimination/dygraph/__pycache__/transpose_eliminate_pass.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9bf3ecd3155befdd756e84c502f17040b839880c GIT binary patch literal 962 zcmaJ9E4=ro5Mzz9jGazL)dKCyAsL zscAte#z7U-V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FednMia%zJX=M7!7RSU7vo{FJ=Q9;72tG;1KlNTzoU}IX#-Ydq6*MTp@X)=u`+ZF2rko0X6qA O&>OI^pf8+SL;f$?vnlfc literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/elimination/static/__init__.py b/x2paddle/optimizer/elimination/static/__init__.py new file mode 100644 index 0000000..caf34bc --- /dev/null +++ b/x2paddle/optimizer/elimination/static/__init__.py @@ -0,0 +1,16 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License" +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .transpose_elimination import StaticTransposeElimination +from .transpose_eliminate_pass import StaticTransposeEliminatePass \ No newline at end of file diff --git a/x2paddle/optimizer/elimination/static/__pycache__/__init__.cpython-37.pyc b/x2paddle/optimizer/elimination/static/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7769b4260730cb68618f886de3a7a33c20d932e0 GIT binary patch literal 326 zcmZ?b<>g`kf(Kp~;-4@vFgylvU;xNxZ~)?B86c6ukiwY5kjogw$OvLH>N;Da7Nd=cAmSiS}6eZ>r7vvYGy5?l&X66Bf^7DYQGB{*Y0}_ji{WMu_ ziI%`L#-}257J(dcO9E3aHNF6-v4|Ncy^^7b4M>5BUs3wGc_sSArFoT!d1;Ax=>~@S z5k>)tDJeOr@yYoqsc@ctg;4=mSUfjN5Vhkt8>(HnaHs&O6;cnmY@la^sv?BMVO6OdP%f4gdzV!C!p=(FRXJ^c z2psu0oP9###9!dVjMJ=IX1*eFj zC8=meDaJt=R4ijYW@T9Mj8mfd2ckm7uZiNCZrFxqk&ZSb8>#4=B%{CZACgcPo=IzA zeskVY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AU2kL)c@GtDjVdQ=%=L^sKSknl=re#K~~m`NnC-QD$_uNvNULk zE=Y~qB)h`iY>wlelkxlY$fz?d4A9e{3Y=kC%Eb9>qz0qOzd;Az`hQB6`)n6$PTvb< z{^5^<1^E{cU`2KJzwnp8?L7Ed31`=esK7gw z4PTk&Hhg*T%erwkCv1WnH6VRM%5QP`#l&a$c=}#~p74Ard93I}0<$hAdww1@4>8SK MaIT;)#H^+M4>y=cL;wH) literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/elimination/static/transpose_eliminate_pass.py b/x2paddle/optimizer/elimination/static/transpose_eliminate_pass.py new file mode 100644 index 0000000..3e43a77 --- /dev/null +++ b/x2paddle/optimizer/elimination/static/transpose_eliminate_pass.py @@ -0,0 +1,33 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License" +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from x2paddle.optimizer.pass_ import Pass +from x2paddle.optimizer.elimination.static import StaticTransposeElimination +from x2paddle.optimizer.pass_manager import pass_register + + +@pass_register +class StaticTransposeEliminatePass(Pass): + name = "static_transpose_eliminate_pass" + + def __init__(self): + Pass.__init__(self) + + def apply(self, graph): + fuser = StaticTransposeElimination() + fuser.operate(graph) + + +# 用于注册 +static_transpose_eliminate_pass = StaticTransposeEliminatePass() \ No newline at end of file diff --git a/x2paddle/optimizer/elimination/static/transpose_elimination.py b/x2paddle/optimizer/elimination/static/transpose_elimination.py new file mode 100644 index 0000000..66819f7 --- /dev/null +++ b/x2paddle/optimizer/elimination/static/transpose_elimination.py @@ -0,0 +1,291 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License" +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import copy +import sys +import numpy as np +from x2paddle.optimizer.pattern_matcher import FuseBase +from x2paddle.core.program import PaddleGraph, PaddleLayer +from x2paddle.core.util import * + + +class StaticTransposeElimination(FuseBase): + def __init__(self): + super(StaticTransposeElimination, self).__init__(graph_type="static") + self.direct_layers = [ + 'paddle.nn.functional.relu', 'paddle.nn.functional.relu6', 'paddle.abs', + 'paddle.nn.functional.sigmoid', 'paddle.exp', 'paddle.rsqrt', + 'paddle.nn.functional.swish', 'paddle.tanh', + 'paddle.nn.functional.softplus', 'paddle.nn.functional.leaky_relu', + 'paddle.floor', 'paddle.erf', 'paddle.square' + ] + self.elementwise_layers = [ + 'paddle.add', 'fluid.layers.elementwise_sub', + 'paddle.multiply', 'paddle.divide' + ] + self.reduce_layers = [ + 'paddle.mean', 'paddle.all', + 'paddle.max', 'paddle.any', + 'paddle.sum', 'paddle.prod' + ] + + def get_transpose_num(self, graph): + count = 0 + for layer_id, layer in graph.layers.items(): + if layer.kernel == "paddle.transpose": + count += 1 + return count + + def operate(self, graph): + total_layer_num = len(graph.layers) + scanned_layers = set() + optimized_transpose_layers = list() + optimized_reduce_layers = list() + optimized_concat_layers = list() + optimized_elementwise_layers = list() + + def get_index(layer): + if layer.kernel.startswith("paddle.nn") and "functional" not in layer.kernel: + return 1 + else: + return 0 + + def strip_transpose(_graph): + layers = copy.deepcopy(_graph.layers) + for layer_id, layer in layers.items(): + if layer_id in scanned_layers: + continue + scanned_layers.add(layer_id) + percent = round(len(scanned_layers) / total_layer_num * 100, 2) + sys.stderr.write("\rOptimize Transpose Layers...{}%".format( + percent)) + + if layer.kernel != "paddle.transpose": + continue + if layer.attrs["perm"] != [0, 2, 3, 1]: + continue + transpose_layers = list() + propagate_layers = list() + reduce_layers = list() + concat_layers = list() + # 此elementwise_layers专用于存储shape(4) + shape(1)的形式layer + elementwise_layers = list() + can_be_optimized = True + for out in _graph.edges_out.get(layer_id, []): + if _graph.layers[out].kernel == "paddle.transpose": + if _graph.layers[out].attrs["perm"] != [0, 3, 1, 2]: + can_be_optimized = False + break + transpose_layers.append(out) + elif _graph.layers[out].kernel in self.elementwise_layers: + propagate_layers.append(out) + elif _graph.layers[out].kernel in self.direct_layers: + ouput_index = get_index(_graph.layers[out]) + if _graph.layers[out].outputs[ouput_index] in _graph.outputs: + can_be_optimized = False + break + propagate_layers.append(out) + elif _graph.layers[out].kernel in self.reduce_layers: + ouput_index = get_index(_graph.layers[out]) + if _graph.layers[out].outputs[ouput_index] in _graph.outputs: + can_be_optimized = False + break + if not _graph.layers[out].attrs.get('keepdim', False): + can_be_optimized = False + break + propagate_layers.append(out) + reduce_layers.append(out) + elif _graph.layers[out].kernel == "paddle.concat": + ouput_index = get_index(_graph.layers[out]) + if _graph.layers[out].outputs[ouput_index] in _graph.outputs: + can_be_optimized = False + break + propagate_layers.append(out) + concat_layers.append(out) + else: + can_be_optimized = False + break + + visited_layers = set() + while len(propagate_layers) > 0 and can_be_optimized: + current_id = propagate_layers.pop(0) + visited_layers.add(current_id) + for out in _graph.edges_out.get(current_id, []): + if _graph.layers[ + out].kernel == "paddle.transpose": + if _graph.layers[out].attrs["perm"] != [0, 3, 1, 2]: + can_be_optimized = False + break + transpose_layers.append(out) + elif _graph.layers[ + out].kernel in self.elementwise_layers: + output_index = get_index(_graph.layers[out]) + if _graph.layers[out].outputs[output_index] in _graph.outputs: + can_be_optimized = False + break + if out not in visited_layers: + propagate_layers.append(out) + elif _graph.layers[out].kernel in self.direct_layers: + output_index = get_index(_graph.layers[out]) + if _graph.layers[out].outputs[output_index] in _graph.outputs: + can_be_optimized = False + break + if out not in visited_layers: + propagate_layers.append(out) + elif _graph.layers[out].kernel in self.reduce_layers: + output_index = get_index(_graph.layers[out]) + if _graph.layers[out].outputs[output_index] in _graph.outputs: + can_be_optimized = False + break + if not _graph.layers[out].attrs.get('keepdim', + False): + can_be_optimized = False + break + if out not in visited_layers: + propagate_layers.append(out) + reduce_layers.append(out) + elif _graph.layers[out].kernel == "paddle.concat": + output_index = get_index(_graph.layers[out]) + if _graph.layers[out].outputs[output_index] in _graph.outputs: + can_be_optimized = False + break + if out not in visited_layers: + propagate_layers.append(out) + concat_layers.append(out) + else: + can_be_optimized = False + break + for ipt in _graph.edges_in.get(current_id, []): + if _graph.layers[ + current_id].kernel in self.elementwise_layers: + try: + x_shape = _graph.layers[ + current_id].input_shapes['x'] + y_shape = _graph.layers[ + current_id].input_shapes['y'] + output_index = get_index(_graph.layers[ipt]) + if _graph.layers[ipt].outputs[ + output_index] == _graph.layers[current_id].inputs[ + 'x']: + if len(x_shape) <= 1: + elementwise_layers.append(current_id) + continue + elif _graph.layers[ipt].outputs[ + output_index] == _graph.layers[current_id].inputs[ + 'y']: + if len(y_shape) <= 1: + elementwise_layers.append(current_id) + continue + else: + raise Exception( + "Unexcepted situation happend while optimizing transpose" + ) + except Exception as e: + can_be_optimized = False + break + output_index = get_index(_graph.layers[ipt]) + if _graph.layers[ + ipt].kernel == "paddle.transpose": + if _graph.layers[ipt].attrs["perm"] != [0, 2, 3, 1]: + can_be_optimized = False + break + if ipt not in visited_layers: + transpose_layers.append(ipt) + elif _graph.layers[ + ipt].kernel in self.elementwise_layers: + if _graph.layers[ipt].outputs[output_index] in _graph.outputs: + can_be_optimized = False + break + if ipt not in visited_layers: + propagate_layers.append(ipt) + elif _graph.layers[ipt].kernel in self.direct_layers: + if _graph.layers[ipt].outputs[output_index] in _graph.outputs: + can_be_optimized = False + break + if ipt not in visited_layers: + propagate_layers.append(ipt) + elif _graph.layers[ipt].kernel in self.reduce_layers: + if _graph.layers[ipt].outputs[output_index] in _graph.outputs: + can_be_optimized = False + break + if not _graph.layers[ipt].attrs.get('keepdim', + False): + can_be_optimized = False + break + if ipt not in visited_layers: + propagate_layers.append(ipt) + reduce_layers.append(ipt) + elif _graph.layers[ipt].kernel == "paddle.concat": + if _graph.layers[ipt].outputs[output_index] in _graph.outputs: + can_be_optimized = False + break + if ipt not in visited_layers: + propagate_layers.append(ipt) + concat_layers.append(ipt) + else: + can_be_optimized = False + break + if not can_be_optimized: + break + if not can_be_optimized: + continue + + transpose_layers.append(layer_id) + transpose_layers = list(set(transpose_layers)) + for l in transpose_layers: + output_index = get_index(graph.layers[l]) + if graph.layers[l].outputs[output_index] in graph.outputs: + can_be_optimized = False + break + if not can_be_optimized: + continue + + for l in transpose_layers: + _graph.del_layer(l) + + optimized_transpose_layers.extend(transpose_layers) + optimized_reduce_layers.extend(reduce_layers) + optimized_concat_layers.extend(concat_layers) + optimized_elementwise_layers.extend(elementwise_layers) + return True + return False + + before_transpose_num = self.get_transpose_num(graph) + opt_graph = copy.deepcopy(graph) + total_layer_num = len(opt_graph.layers) + + while strip_transpose(opt_graph): + pass + + for layer_id in list(set(optimized_transpose_layers)): + graph.del_layer(layer_id) + for layer_id in list(set(optimized_reduce_layers)): + dim = graph.layers[layer_id].attrs.get('axis', None) + if dim is not None: + for i in range(len(dim)): + dim[i] = [0, 2, 3, 1][dim[i]] + graph.layers[layer_id].attrs['axis'] = dim + for layer_id in list(set(optimized_concat_layers)): + axis = graph.layers[layer_id].attrs.get('axis', 0) + graph.layers[layer_id].attrs['axis'] = [0, 2, 3, 1][axis] + for layer_id in list(set(optimized_elementwise_layers)): + axis = graph.layers[layer_id].attrs.get('axis', -1) + graph.layers[layer_id].attrs['axis'] = [0, 2, 3, 1][axis] + if graph.layers[layer_id].kernel == "paddle.add": + graph.layers[layer_id].kernel = "fluid.layers.elementwise_add" + + current_transpose_num = self.get_transpose_num(graph) + print( + "\nTranspose layers optimized, before: transpose_num={}, after: transpose_num={}". + format(before_transpose_num, current_transpose_num)) diff --git a/x2paddle/optimizer/fusion/__pycache__/__init__.cpython-37.pyc b/x2paddle/optimizer/fusion/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2d4cee7661d6a69b3023338ce8d015e5ec2cf916 GIT binary patch literal 165 zcmZ?b<>g`kf(Kp~;z9Id5CH>>K!yVl7qb9~6oz01O-8?!3`HPe1o6vHKR2&LzqmB7 zGBGbLF)!V~P(Q*bATcE+CpA7fKP45;)2}cp01NBq7nEe?W>%#Z>8F(zXXfYW$H!;p bWtPOp>lIYq;;_lhPbtkwwFBAn8HgDGJ)0_k literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/dygraph/__pycache__/__init__.cpython-37.pyc b/x2paddle/optimizer/fusion/dygraph/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..49182bcc70bfee1ff8cadad8634a324db2e43c14 GIT binary patch literal 1715 zcmb7E$xhoq7`6!^35k<9iL+65C`~Dt=3G^UBBWLoihx$tTr6WdVCf&*vK>@-qrOeg zoGSIySLmrT;~8fGD%DY(Z@y*LKXargixPQ$e*9tF;{tmf?9=z&Vs-I171PKm~>uU=bHlk>MPau!0nZ^H9bWRAIOP zRjeYF;YFz7I;t~Vga+1-#&8LmxP@8_E6~Or)M2;`UA%;r7_PuGyo{C^uEGjlMXL;} zu!h&sI>R;Cz?*23;W}*LZM4mB1D@j@w8O9lFK`d_7;eH#yo+`jZowuL zPH^X3>UDpUosxR;efRkGDl~)ZL)#2u_r@9cKJ@LAQRIX~U4Bv>m{CLwEp9k6W9$0V z5AirFdY+MZur7k9=avbM7_j+}=79!R-uqq@n_esuVg{2uk7(n_P5=1NPM6hwOqiM2 zap(vBC>=&jY=Y*2GVkof5>ryA7;anTm$bw@R$@FiPkC*YPcm7ml`lObqUFT{3zV!)k%^mJ zD8y~?(&Fwsb5D_pyFi615pMdnVcItL)B6cEX6PhQq>^GMCB^L}%BhoF;#DZ0A6nd2 zrp*#>CXNcFy6(7;j7wfgJX58Hl_w2JFDf+^gV2EykJTts88eBmPFW>P3Wz%!lv5|U z#H&%h77vZ|PAKs5ysu4>iMvCD?^3u#e%R~J7ae=C9*w+P z(;J%J)xm51Ykxq_g`B(P+fLfjzx4w~>pr>buzTl(I;lX{_jEhC1$D!4JvTOt{owXK V{|5W^2%NWczoUKfD#`!z`3s7{5}W`4 literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/dygraph/__pycache__/adaptive_pool2d_fuse_pass.cpython-37.pyc b/x2paddle/optimizer/fusion/dygraph/__pycache__/adaptive_pool2d_fuse_pass.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5a95db551382e8b001eb8f1683a3a1ef1dcd34dc GIT binary patch literal 1007 zcmaJ-#;3z!pTPL__NO=x3HgnS-H0GK0kfyz6j8Jw zCFPW2%nDWpJn(T)gk{7dN_6yws8B_hL`9lzf(_-djyHt&RQ!&ly+4qLq|}8|X)Vlm zU#%8KHfJxCY})*@p4N3SR`1l~tSBWwnykTvm%GPqX*qsZ^@aVpc1CwaU)N zjsKn1AWxaEwaEZcURT)`aCQ*zs9BjFR67E*h=DRI#rN`wy&xi3{7hsex+0lN|ss(*B7F!)e;mHZXm>`r7X5PA;y2E0Q4j3w_?F0`Vn$>U&<=@60SIk+Ka_*xA{0 zn={{>Gjm24$H#LDe*gK&znxznSCp^lqyIC|`2n8jM`)PBR9~s8;;mIRyft5M7*#_h zp6+KFX4Pz1RZDyuzWsCMlEN~~ysa?PH8%BXmZ@(kMXLvE%H^V(*gtGV?!{W<7PVyT zN{un!y~Jzbwf@IXYwIqDoO-fOD*d0HcA^DzT;WnxdtX^qnaZ@=c2#FOGj1zYLk?ce zFpJsvHs4narE0;2Y;x?4^)(vm0;`3wchkMnZ2I$z{NZ&qwNGyvi=OBuG_ew^U1d|d zuF*(as;b2LrqWd$gDJ48UrsD0&BE!Nu z*kLV>T^>ZxG9uSs#XIXbb-xxxj`KI=oBB*6h-ac!uwDyRYr)#=+{`cLC0ex&zov;&%89QL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a9#y;A6itheDm7Cf*n)gGm+zrd*H26w4BcX(q-EcRiBa zcMw-Mghz>q*!6<7BqJh^6X=PV;*;g$_~ZmlVx=)zwY^noy*iPS9AR#DzRn4Q(lo=mN0o-_$=IB}$@Vtn>BWhkyHPyyn4qrL- zkf7uSavEq-XA)&|UqjN!9`z=KF4-sPJZw#>dHqQvl7y6%qe{OfVJok8rk^#x>!Om! z+$asH|2m#%2~AhMuAm-Qw$-lI)pt+>$9Qk+qC!?tAEWMtjM2@Yf*aJk;*z6X<|6OS zB!}F@)`Oc%l#GiV#Qjy8s3Pvm7>J)mljvbHESh4qlZ?0)@fD(5japp4<|1l>zG^i; z=sNrNyGbvgjn^5-`~hYnae)=sOaj}^Yfr&vRKHFkO+T_h86Y6~7#-}xxKW>=`MSj)7`Z5%zH>rtd3}CCFO=P zCO2=T#^Y|4M3;`A^$Ph)tCF1`qJQ1 zU+QmnGJ!a!1GRc^AXsm5w-oXwa;+hDZMim6!vd|?^TnXMUdo=VEtci1&lBt-$7nCg JW8bp%{{tIWpB?}J literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/dygraph/__pycache__/batchnorm2d_fuse_pass.cpython-37.pyc b/x2paddle/optimizer/fusion/dygraph/__pycache__/batchnorm2d_fuse_pass.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..803dd93e7aef4767aa32c44f2e3d34cc26649001 GIT binary patch literal 983 zcmaJfo17>X9L;#Vp3J=W#=dM@?~zYNlV5*556(wD&%k%6K+Z%5Nmg*%cCWcY@}gI`dG#MJud!Wh`^ zzF04{Xf9@=%`WD(E~oP4$|wz2;|5Z=R?FP9N@w`T!(tGefteF4Z5cGUVj(FU?0d10e^=ODhGit00YPV8HEnGaQDETgPEJ)TJnW%$ycWZFr)LB zX~bnC&hsj7IY*jC6^m~~-++tXSyEPQVpi2!R0~lppFB<8PS1suh2mK))%7X)IBneL zq;A^0%r{CWfGDr4WDhp!1v_chdH|h{!3<&{bo2P%)F%g^nahQABnVHSBZ*a7vLm0^ zmc6H2Dyd|j8IBw1dUNZybyEY!VTr==4|yd)0xV$%b)&RsRqW{q&w-n<4Nz9?#ONG8 zJR69nDc1KPG}xQakZw-?gW9Ff;}C_eM5#EpL(a=uu0Tg_N1R`-M6ti|ad)EV+fe(j z-Z&DC05m@GBQO(!iA=`BQ$Tt*ar-iSt{KLP#$kpKVy literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/dygraph/__pycache__/batchnorm2d_fuser.cpython-37.pyc b/x2paddle/optimizer/fusion/dygraph/__pycache__/batchnorm2d_fuser.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6367d242227dee5cff6e930cfac3a0091ddb3794 GIT binary patch literal 4166 zcmb7H&2QYs73Vj(>y@ndBaT!zS*K0yb?W_~Y|C=(G;k6JC<>uyawxVah}8}yQ{i%% zAs5vy)<6;o$e~btD0*pvKu&|8y#z^*O_2NxJ@Zr`u@wFby|nMWAy-RD4q7faoSFCi zoA+jC?##@TC3ybzi+?%`^OE!p4)RBX&WrFy*f5F7zSNfCtN2P!ZL2cQslL|J+j`Gv z8#LB@^L6P}iRsMPmYCtHTWZ^4@@rDfOhJpZQj-(w?jUmSbRxH=Bqx5=Va#`5<(=?e zKKNy4=yKqbFLzNSf7GlKU4@QIuC$eRr8Sw!Oxd>DDpQ%ZEwwdaysa~nSui%o$zz!rTk^Wh%pJ&y zjAk)S%s+-+V&y6N36ig{nH^1N*p=BVX#fgoIEfq&bNx!Jk{xANdnj$mY;Infm+mXE zK33Qh?9`5OUmdI9;b~6-D`!aiS@tApS9XoD`ViJ}id!4wtcJ6h|Fa}nA<1*>sobxP z<1Oo;OD|YHz-FFw2yD=&1@;5*31%s-^F%e+56J@31#&t4=|j@b5NlBP#7a7vWZ}dVVj|CAp6IP94~|E}0yL}w8Y0VtWS(VK?!y#!X^gWa@=S+b zo`relXk(nEEM$;R5RDDdh+12m)Y?_T>>Bu~uu^QP8+M||XkGeUy2}N7o zd+^}9uRlvac%EJK+3QYgG>H(RahZTvQu>(RYV=pIY= z-QW`O){c;EAr5LT+^$|Nki9iBU{{Mq(J=3Lkz4&Wwy$h&vW!#~0bG)#`6Ft_A$coa}p5_uE;*3~G+Q;Xs;J_9_WnT1|rt-FB}bb79h3bOy< zrN{jbuMRw)IbkP`T^`hL`TZ{B=?nE-$EX}~uO|vC(Y+uX#G~?RaD{qTnjD>lgOx$! zC^7qk7+9i_MPiVSBa?c8%TEGpiu@@a^=c|V10Q}CnnWIEY~EUm4yXTthnvWzB$cqk z-5_>+Jg9LCCP%ZR)6MHH#q(2AniSu(ZhjhQcWW|zQyrx%B)#s&UhMV~&G(`>#goUh z7{yUr~zkD zcR7O?p7$^etUd`4o&)?w zmmY`5VbLz8Ek0QM*e6KNLkG51WmiTR-~m{7uXDJMJ5Ew|oL-*|eC$^o2e%$U zp$ivZ0^R)Q*r2^+CcE-=UEg<{gOY%X$8Cq>20|A`+#1zabBasrAof;}(v&R`bGiO6T~~ZZHT=!OTN&ieyxhj7ge#l1cB9WPT5y z1wEj>yN`g__MYsK`Ma7M#O5;q=LnorNR0z$59~RZxel%)U+J2Ba{>Szn#N3HK{n#N zsEdws8fIzCKzva2w6_uwirgNFC)FhfT+KQ`1JqMH6?%uy%m$)u z%jJCt4Pp}-($$0iRP3&%afs^HqEejOA?H;i7a$(DBhEiAM7cfjadu+pn~?V(T0{OG`O-=4{~J-rym2kyBvm8iuW^gz}Q c)ZW_f=b@@?^t7k^>;{&OL`D=oZ$zWfUtd1=i~s-t literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/dygraph/__pycache__/bn_scale_fuser.cpython-37.pyc b/x2paddle/optimizer/fusion/dygraph/__pycache__/bn_scale_fuser.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d6bfb59f13738c62e1e044adb4ed8e41bffd683f GIT binary patch literal 2948 zcmai0UvC>l5Wl_uKHF(Y8>*s8q@{woYV9QOfKXGRP*H(Ugj61og|xbOFUf`T`Pe(t z*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mt8C zxA0Z3nlW+A(yj$#>oG+)_&8U+t zOz&C%8W;E}G+?ym@kyBb09rf+9VQtf(vi)PqY{i9G7fb1MGWf_$u`*^og=WR*mxnr z!%!+5N}Da#hU*FyB}%_&yFs=hZ!P>)uz;V&ZW20C&M!?3F9;~zF&qjO7I%)hEw5Y{ z6A2QVlr+0yTXGieeTF=@P{T-^7~G|*!@E>9uXZ#;Dd$)|>k~u9MvHsZh_?XOO^$$) h(G=sO4DG}Zoe|IhP&yJl5=ijR0g@`wum599;ka literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/dygraph/__pycache__/constant_fuse_pass.cpython-37.pyc b/x2paddle/optimizer/fusion/dygraph/__pycache__/constant_fuse_pass.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a699d7b9774b5433134b3fa1894ea0c44ce5ca00 GIT binary patch literal 962 zcmZ`%O>fgc5ZwyeA}1`~^8`{8->=I!xlG$1g3z4FO;n`fOQK>;*L+R$p5|+k_f_v5N&9~w4@s$yPNj1& z@4Z~itZdFtYU5gI+E;U@E$ojPI2TsW3fF2o#lNJnT)<#P4qv7+)zc?jB;0_{omrPN4BdpspK_cianUDrw{l8iKR~ csK0kz(Op&hrW=)iMV+=$xL1uCh1zCe6ixH6}sIbyRi%xg#rgwU}d#iim z%+L#)>_QZY3HW9t?5c>qNb+hV`2#-Wxt@e1yV<|si=I=`Knj^_P-(x{P5Egz-ES=LW@LziaSO}G#ia7&x9 zAPO?Z;FOW_Z~^{h#=Ou?Q^tNJf1hu4qO6s6qrMw0xY6RV9m6i6^H_W5|$>YYdw zK&?2*f=)2tqP5UXgE(pp6=``xlNhXX(MP39RB7ru!zKV|DKUQ+@0D^(Xgl?|i@dhtKdvYJ>|z`}{_WQGH@6?%{c(Ha z^7c=^Kf3qz+hZ2w?47K?Q$K!eVr?N7b=G_9SUrg90)XX5dM6u`Y{=SdHpgs(S|Wl@ zbEJgSddGJVIPj?zL`gSGWhw4viZCy^VVBP}3|UItEaM`QWpED*F=C~8p&Nw0m_}wQ z_P|fn#=~BqWKEr5L*9e1l-e+ml0~Ozg$@oq)l(Bp9%dyr^s)(E1??&jyQ%OM1aPiz z&`q)iZaYX;3^fO*4d-TVEzIZqOTaa zk<+#&s%l5e^-T)VrNKE~IlAV8`HOgWi(9#St-btmN#ECQ^W<)BjHUth2rF9{Uy*A8M_@vV2 z{vuDIbVz-XXAN7{)CN?9DB@n`R61_vU1X8l;m)3dR`DolThdDqekjhVTqwek1-?@n z(olbDf+wNtai&;`z{HpohhcaPdRm8p(EZe=Rft7PQTVUGSB2R$-Ae~EPmRzZg3^<* zh<{Ps-JAhc+%P@WoV*p$5f~F-oDl|TCXF`l0|H8^RHcr15%y)dzycCa)RE~GWU8p7 zlBO!WvXZz0pnxod3{`M&z_5TU@TI9JXJ4^UWbhEXVoBZUR7VU9?|K#Q!lZ=+Mqq?W z+o}KBhg&J;Iic0*DV4hwz(?iq;s1pYyh-p%peq@Z6~;QT-wlzjGPc}x!(vC3a`8MW z(t<(OhL4EH!;rDv>H^wU@sM&T=G_74DH7mJ-L9%KR~F#Sg=6 HirV_Wc&1)4 literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/dygraph/__pycache__/conv2d_add_fuse_pass.cpython-37.pyc b/x2paddle/optimizer/fusion/dygraph/__pycache__/conv2d_add_fuse_pass.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5dab9a1c02c14edf2e7ac40027602538ecbc1bbe GIT binary patch literal 955 zcmZ`%J&)5s5Zw>kF;M~(AVmTJSGtKIHA2VT2_%Z>BpT#qwPZIrgYEcs9Ymr~8g&t&phr3slUklM{t+qnVxcPUgKgvnRu0pTPR{=BJPWA;0l(SRn+*VDA6{zrvs8G`#-_b16(T-$26}=@%?+?@=33b7_v=;XJ zXX}NL^~LG3`ZPIvsnn~L)dntxH6#e57rAY;nc?3Ki$QPBgf zx}}OL_Lbq7K`WoSK&yoYf&Ef8vkUPtuN3IV60WzbwULcZxQX!``q{b=dun_qT89tL zg|e=T^#cekViOwC&7&JR`{Zd7VUH_WY9U--h;pe`&_dw`LR_w7vA+p$_YE<3q4Iyo zI1PjF2A}plFdKo3S-@iMzfF_ajSf>7Ur%A&zDGaiqmJu#NaOvG+IBqd$n#}NS;+-- d1a*5*gCx3Wy7+mk@x>kFip&QTetbaV!9R>_^H~4@ literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/dygraph/__pycache__/conv2d_add_fuser.cpython-37.pyc b/x2paddle/optimizer/fusion/dygraph/__pycache__/conv2d_add_fuser.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..30f446007f770333e6f43e7f8452a00d0a1281d5 GIT binary patch literal 3710 zcmc&1O>Y}TbY{Qp*l8LFRRJN3B2<^uX#xm@+KQG45GqlnqEgJq;Ci;nw(H&P?7GC( zS}HVB4-hKB4G>BIA-Ev8p;DE;Ld+4Uxl9I0@CwRZN+n>X*hd7tCs z<#Lh0^ZP5mu|LNNxrLMdqXFgku(6__io+S2M8MV#vDEu(I<%(^M( znrppAULsuQ#uDL%tzA*;1x`L#dA zNG4`G^C;>C-@7z3dyI2bMKo!~8oww8-|!I_A`;P(f}`o-;cWR33O{r&Z{e0tgNDo@8u+* z<-kccHAKm9x&g_9r`S<4e*l7NPrC$OsjOYQcK6pGH@>)h_uKc^KL2%X`K$HMmQr6n z0lvKR`OWoTK3)5A>DJ{Bik0lyvi#ErYu~Njxp6J%L<_!m=Z7!XKmPIdFJG^(yubd< z_1iZ;d@kRV(%t^~@*g)o%aO18XC2q}?CA6~JK@heQOIP@a5mj!(~HyWtOE%gR*qCK zd~5eep0m$lG7=3h4E)e$(@z1bG?HsMcK_m$A&ie*nm_6LE}L$!44kY$rnQc|d1$io zhn+gLk01ZQ2wf zX1Fzn%kB&_{2*x>0Gme1!sz-(|6v&YAHMw`Oq&Ozk<94}}`VPg922!Za{_OuYYkxL1a?w}+- zcxVGRZ(z6CKs~EkVqAcZX}e+qrs4q@5)IQn=jM4e8KJX@E_qZ{@gS1s^xa}67m}f> zNSO)kbj?g690p0}s=7e2Ndd^1i+7Pkm&Ooi@x*8Zf$eeNUPkWsBhJjswB6q20V6&H zq~U28$SzAQQjIF`8)n0#;K-(I_@Dy14`JEI zX90-G3W?R2t}4(0>53AotF)&r?vJ$>FGTqHqL9DUNA)^R#)^`$Buci z@;Y1wWe8T49im~t`bJWgfn>jzSy*fOK_{`eZ3hz4oycy5(t(K@_(9c_=1z2Z$4bDH zS&%_kwHi@#!4B)C41gOF@{+D&4o`FmZTHQX)?j>MX#A$$gmg_xL z&J38H07&H~P?!>D0d6$bde+6!*U1i?k>-;aIV!wx7`z&O660=_7h%?yvk+Tw-_l}j zFS%fdg^a>HOfD{D-W-{GaR+B68eCvSo_cx5er>ClW&Yt{$_({a4tg*r+BWbmf<*sgGX@OYS z76f7+Yk~O)(-(Fv5I*EuOV&bxF`bML60{@7l|nbQ ZOrf;Z98OPt6kCu?D+?-G3F?@o{tfKN4Y>dS literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/dygraph/__pycache__/dropout_fuse_pass.cpython-37.pyc b/x2paddle/optimizer/fusion/dygraph/__pycache__/dropout_fuse_pass.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..44a7e4cc535a2c1dbb80ac5f01a487c5aa576532 GIT binary patch literal 955 zcmZ`%ON$dh5bnoJGKRzlimWKC9_NzLJ&P>sqO6Co;6>)rH0e%ubY9y%117{%_UeDo zqyNTpp9D|)7d%_LnELAbs!v9v0fF)B-A{2A5b_%r+Yv%=3}#QjDWYgj z3Yt=iG0R!OQ|@D)2Su2Ml<4p+QGp7thzd1b^EFL-ny*RPSH1Tn?q5S55>pqPOKV}i zf4Z0(Sznx*s;=7RO>4D*?NJTK!svNs8*Qfe({?Zjj=}6xaGIo4k(4Q#a>W$CB5BaU zr(p-^9_}I_wtJ*HWT84}F#~LYxKj$5ap26sUW3`&;2QFcuE=-KAK1`I%na7!A|bLe zYlJ{*R_C)H#N2{|KO!m0Cb4a~kmXF4^XD&;4@c)xsa%U`rS#1z`FvFS?WC%ktjLzy zBv4USmC2^iWT((^y)b=1IRLX*2cgTu{dC9M0;m2STt#Bg?v5O0Xvms;VJr5LuBf7l zeP!5MpvfmLXrMj7ZBWQ&dLce#r2^`h!u6|K8`(O=yoUpZup{e{~Y~P~1`$S_n4~qNr30+6gxl;F1LEqnJdyc#Aj5pos#5mk@&!;J5Dd(UEvi6|v b-cCFB744#z9phJbuyW)vr10?}jfQ^#{YLoL literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/dygraph/__pycache__/dropout_fuser.cpython-37.pyc b/x2paddle/optimizer/fusion/dygraph/__pycache__/dropout_fuser.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d956e2e57d15297b31fce3609288548f25398b71 GIT binary patch literal 2168 zcma)7-H#MS5bvJvU3U36!~{jN8jUQG-2+Ta^dtm{5MwSxO}MNdongE0nA_Qzxt>|v z-OMGxU4q6S5Bgxl7*J#M#lWi=_!oTcCllZf{skY@s-C&MoZ-QqOm%g4Rdw~RtE!LJ z>s12n&$s_ze^&^(hl7n~0doxg6bUDshNMHGH$tOtc1((MW@z>8j@@@UjviZ~`#w2I zxXqna!X06*m>rMP_ej%y1XjpwlPd46K`M^>sc0H%+i9QkP@I&0a&BYrjz1C->61V*lF^*37>fp)zC!V2V8)zPE-&nWcU5hWWurtiO=YKpL`dm?w(=MY zq99`oq^wkg^Uzlq>xO=sGWHAk>w|Vb%G&858u`(@A1zEDYR?@mfMDI2i^-@xJe+8J z+HsNv{a`F)dw!4xanvpyY4hSl45o!_B_oOViHArHAcT(hJ?7}G4G*_qV1xXds5t{9 zCyQiJL(9#8asYL~;La7eb-iM6SI>JI9leV4%;Xh7syes@CK_v3uRgqc^U=2#9{zN3 z?b_Y7E8nkwv)YZLH1nhE!L>W< z`WH9v-~M6!`o;Ahf4hI@^VcRSs5v~+c%yM>ddu8=EE{b2>U1NB8WKPj`-exGTh&mt z)oM-D#=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ser.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..559fd9887663804acff209b0333ec2298996cdd5 GIT binary patch literal 4197 zcmcH++in}jb!Tr}UL>nZWJRuHGilnIwoF~D`qElK;06g$1V(`rMZuz2tT;nymF03h zyF?^<3B-|r6ett}?L&da2&lFwnwKJdZHnX<`aDks5=-GP^rby#W=V>a(xNCzV&`(^ z+~&-j%iNoqDroTg`w#x+{(N53KF7)6XTsnW_+o6RMoFO62=scOH;tM>5M~5s)2dlb zyJpL|8RUMXy{=J<+WQ){nXzZo97^8QD!D#z(e77>a9(T2?4B31iY|&j^e7G3>)eaB z29r0uUB&^AT&*L?;Adomcntls_#2BgBsM_*J`E`UbAS9Ixx52(@d?F z0~PXO`qkY{6!lsib>MZ9@x&ha;}>6qhLTiswS**ks_p692Gyx?KyZt|$Gp#xK;)?6 z2D%m`TQ}K_Sj7~jzz>Db122wU_ap5e zKVE8v$x_@7cfGLTg`3MOOFvmvMsn*d%7(M0oz+O%ZmAU|e$($TzSL;Pek)wc)LLrP zU4SrNjdpnvq@RZ`##7aZO*-@Awx|v?8ydv|#2kFzhcDjH(I{YOtqZ2v*0u?nn_50e z3AOjgCZV|lxD(l$Lrn$$iuF7#oLDbPdYhIGOvRx`=#=CDE0V)BVjK?m>pcUg0d@#S zA|;xMrTU(IsO=GYZb4hnx_XjJbvi@8cA$5S)Bv4leGMp|IiW8?pQUpODrKFQtMl}^ zO`R@CjYgCgCMdrSbO56k^gu^1K0(c%&p6D}O9vKQ8Y|Ve9eVk$($(o1)RLMb-?H2% zP>lAOSyJ!iQv>l%?7~dVGk1Z||FjFld10vOi%)dW^c$o7WLmxiT8?CVbF?m@-%>Qt z!U|P9zMbv%inJBdsyzYx%srXIQ!CKRc!Ov~y4F>2t!r%tK3G0_{P@eyKJGtx=gU7l zI{M(Vql4cb|7O2YfBM0v$DjP_=)?Wb-+8xC&VB&?^SeiXJbe1s$I))G)e4{f>BHmq zKmOvA-yQcJ9sm9>UwrzD?+%fXW@qKbjq*BltGBE1mKU+JRs$AZLBz`B;+iBy4(sLB zu|>autk=rp(omvwZ@=L)?%s6YX8z_@0$kAjt7j~YG0had3HZw0s|okQIBLc0%Fg;3 z)Qe>ZHqG^)t}K?9e>SfDDOEOnFFsQdTsTXOTO&0f_B5MU{4i=K<7y!7VtHpB?Ymgs zh5p9P#qtJAymipY3!*I;oK_6bz60E$yEP`61u^@7SoHR2EB~8CLE}3kUQI7)wgWht z6WhOidbeW-_un4F+Ojg#o$|HvO8M&e_4=x#Q^s9e9vXKT=LgB}O^ov;Xedb_Qtgp> zOm_NxL3SWZ8F7M1S@$WQ1{~F#gOPAHS?GpdlPw_w$PPB9YFdkO# z2Ccdm#4lF|q@6;<{ibq9VaZ$7DKzTW<>>lyAGt!gV9R+da;VE>=+jl|e+i8?=NLB8p|qKX?*e=}DG&$# zm&h!+NJ_*6hz_gRfUmsq*Gnm z1EIzcDlxjY#5E_NPzwUCH34-Jb5HB$QRTU$i1Jm#YY@WyF5;UUdhi(HxRGY(@l^`q*XB|hq zLLPP@Bp|K~N}c?}ZdH{aog54|AX^W^Sr}H|kS`aY7>3SDiI1+(5GqXS*AsZ#U;!oU zMvKG6;TUg3ewa^%9!4S;KWH-s&l9}kz)XgKTd2=%iLGJ?+$>?qp(w~8Co_sDsz9Gj zl-_ERN6ppHf~>-0QOsUln2Puv6fmBsIQrHj_~KP)@OGBqcAorf2o$pbnT7yy9s>S{;9*!DJ`Aga0IQsvb4;hT vxglb`#aT7tEeHoq6~OVV#OydiJMjZ4aHOFcsVd;E+VRUc8z>3>?->6Anu8)n literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/dygraph/__pycache__/interpolate_bilinear_fuse_pass.cpython-37.pyc b/x2paddle/optimizer/fusion/dygraph/__pycache__/interpolate_bilinear_fuse_pass.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b29b28ff68806c96bd115a647d75716d90baef52 GIT binary patch literal 1042 zcma)5J&zMH5cS9IW{DD@pg0MM0}8|nDGOI4bP5OrMRXDk+Qu@mFSoE?*c*vNp~|(i z)KKzos9hmZ@fWC=@g@gF6mT?Sdu`9W_hvF44*LYg_ZQ#9r+|>n7RO+A3{DY6 z3sTaIQe3lwl|18q&5NK6vyc)UJ|ikn;W<&Erfa^YS)`*i$$Bb!Ns``Ah(i+Uf)i;i z%!f}FGb5X`=T)msQx~$;DSl3}po5ZyU2=DOe>TMA?x+rt$p1hRuQ!;)DS#3PXi6a^4xBmIV=#LeTuVOF z75U;t0?KrfFoQr{EFfmy3W5BsE>6D^a|sT96=_+ushw8~S)IyicK<>8>gYr&RcJA- zmA=@e?~fY)Ijx&EFY~1~DIm)0D&3$?_oE&)3)6#?2VfRK5xTthZ&5~DYss2?U@P{9uBf7lePq}ez@JZC(AG^2r2D08r)T1AUMbK7L%3euXahx0xQTHe z`fhL`>TJ9^ox>J&p=_FBaUGTxa}yfT<=y{4@1ISQ2rE#@QVZewLX@?dgTTTKgm^cX z#pWcy*^6YZLXN*MV66-SG5EK*24*90F$-AC{kKUHyMt|wMi(_2bsg-R;MR`gu7sma t2|Hm9cii(~N?FMnXoCv)r0&N4n(t!Z;)fmmM^}&rk{VF>@d1qozX9%%97+HH literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/dygraph/__pycache__/interpolate_bilinear_fuser.cpython-37.pyc b/x2paddle/optimizer/fusion/dygraph/__pycache__/interpolate_bilinear_fuser.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4bd054eb82861ffb7830011ce990f94872ed6b9b GIT binary patch literal 6426 zcmbVQ+jAS$8Q;5BvYmunNDOHZloAOX*^(UFp)sT(giEQ1mJD=6nVpT!%2~5sDQ8!$ zty#ALXNCvrW~O~B8OClqw0-H&r_KOF{)Im8Q)eI!`WO1re&2U?b+MIZs60M<&Ue1+ z`F`hmabhAT!S7$M{?q!$lq7wHjr6BMv`w{^W%3(RG1CQY(o#{5&CBh;xo8JYQHjT1w;A)C zm$==!mNs6q*BuUg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z6(z&JLhJ zUH|}aAg|8!NeNy8;0vkOn1L+|-bLW$25$ZY18OlycSLW(OI>`J<@mcOjYmv)fzDYL+&0>9OR?f{%fhpU z=%J@zjv3;3lqFB%iR4wf?s%SM^__+NYXX_@NJDSjxSIud9)uNHGk+yrH;)m$nB#8( zHP-3!6)S!#ejbA-{348zBTIVD=Q8B8nEI zq#30cvx1d8<38p^P=;AZi4M<*3RHMWRH*5OZ)g_jXhX7|ir$i>_XqNjgt}lNt%dpE z#d2aU%z{~u-d@puz^Ei^gOq%HdFj%Hy8vbVD=$6O){!T#uUxCVv1jqEaJ$;|RC$W8q%xQL>l$(=C#za<;;g{|2~x~7UM z_LX5nK_VZ!K&!b1UHwwF({u4DuN26}6s}h{+Q?QX+{CyJeHUGbr8K?(ox`W)LfJIM z@*ad1u?dan>h4~?{^B@^u&k9VwGgf^L|Ll^R86>n5T6&a*q#J9`$Cx8ko7-QY=A*% zgAe!+%tqj17OSw|qg~-gSA`#SFVA=O(VpY3FQaW=x>7vYbI+$KWhLiO4b<#G a4U*VL)5T9ajn8f&S7bh*@bLkS2mb)3v+5ZD literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/dygraph/__pycache__/prelu_fuser.cpython-37.pyc b/x2paddle/optimizer/fusion/dygraph/__pycache__/prelu_fuser.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..80ac4579c5528fb00c0b0a38357175007e08262c GIT binary patch literal 4020 zcmai1O>7&-6`t8YE|))&|Ky(ps35e78Q7F1H>gwCZkh-QPz0*sIB?4*SkRoIwDNLE z&+f(~vjmbzKn{iKLvKkCNNrIxKv1ODrbzBR^}MG7iS6j#Q!ni|vrE#J6oCD(74TG7?!rf#AX5(&sKn&6-z@uV%WM!}>Oq5i`x!=aU=(;Vx8HTR=Df#cO7dt_;7{C{@8fsB{quVdKKkmx_8%U8xTRjn{g1wU z_{HxZe6scRyYD;m`7c}f+xrjxvU~p@_j-e9y&K&B>n9I?_xU$p{PE$=dk_E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ncxgkt>7BjNhy~zB*Uw^0)0!dW{M=BeA?7jHC8Y zX2>bMJT)d!S19J3UaKVEj3b~^?LN)vd+G(A@m?VlP&_IBST>Jm^TZB{Z;$Nf%3djx zWhRHvdQ1Cu2hA>%xh3mBvABmWzmI<{o|aJFFRGCd1Ohis6J zu}PsAjSU(xfW{^yi=d6T$VSgcD`eE9BeLs_Xnd&-ufyah{ zmTRjQ0D*#_8x-wafo9TyHa$v4$%@f2pk*__Ou!7>U9t4Jk)AIfM~V$|lgyFJuYAr{ zax3{xzGGcwa;}3stdpA|*XBM=8@@TOGh7~oD^p)t@+jiR5MbKKLja&WBDbN+cA6w_ z;8tH+`rH$VrP10T6cW4(P#?NFlm4_=(uDzzP6~UcJr0#6kohhQH4K2zBK!sTi*$tA zv|ZZIoBxh!*~Ui+n*!%af%8UF#6IFh&acIepPuNaL%s$V$Tty`03-w1!&P^EpYuJv zpl+}^N$ffL*+Wk#jFe4_hJDPo^e();RuDJBR>FcXIof^CD!cDlB`Z3frjnEx^xC0a v!g^D>l~6Vz`5Mx|%P~6C_7qI9v?b1@2A{(g(bbU-Q``6lrZZ=7 literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/dygraph/__pycache__/tf_batchnorm_fuse_pass.cpython-37.pyc b/x2paddle/optimizer/fusion/dygraph/__pycache__/tf_batchnorm_fuse_pass.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8eb795fac50ae5fc8748f314279c0e3d7fb364a7 GIT binary patch literal 967 zcmaJAB8rxz zqB*4)vyxRj=RW3TP=$F&i4I>76{zr%s8G`_-_ktN(U#-`6}=+K;1|>(33b7_v=;W; z&sPg0+l$v{Q`yZfvc^Y@_@d0Ji0zY%i{E`F=Ds=L%K>y@nMvR*uToW40Zmr9jd%o?SyPU**! z)_+c$wkxV)txXDuil$C?Xw$=JC+*4%pw$tWMKFY}AO4&CWRG;_b0HlW!XxNeVwH|; z$tSj9@92gqs@P|S0|&l5bAeV14J3yZ>L%V7wE_*Wgc~%iHnP(RH!+?=KV=u9uEwj; zJA8UBlxH=z+-AO8onPtTGFm9Ax_g>XY5szxnANa038d|1kIcN5_5MKL#_ z_FuhmCI$f*eCD^nYy>W50gJi+mL;(}+RtKgHH%6AGX1b09JuaBHQ9}-7v%ndJYS}g hwOoKE$lNzI2;vY-7eDDaKD~ih5&4M1kB?|P`U96I`NIGJ literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/dygraph/__pycache__/tf_batchnorm_fuser.cpython-37.pyc b/x2paddle/optimizer/fusion/dygraph/__pycache__/tf_batchnorm_fuser.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..60a2b4a7e2c8ae4e530c146166b1dd02c2961620 GIT binary patch literal 4811 zcmdT|UyK_^8Q14^UPh=S+9Mw z>-5fDi?(-CAJCCVytP$zM-eIrq4G*m`_2>Mai5UdB)xZ@c!A$HyY}S_M-eesIKYBkpr)i(iVDy;iJdZcJfre|G1zIEfvWAYa9vB_7VKRal zfz`1aw(6Tfq2n~1PO(u`V=HiPXfJBq=7n927lgfIG)kPkq}7~5NY++sEG>Ocav=r3 z?zdtLofrC%xYmqBO;1bTZ*m@p7iF_|do=iNb6ZHzu?sDdFnWx<6MX|6p*0xS8v2{s zI^&G%yH3O41~+%LhRH2%<7@E(cks2})J&~WfJMc0@%r`#sk-sPwPxJ9z1o!>GDfyo zE}Xukh~DTt8qN~U(_$9uiMFG+4X$%zk1;JacQjxuu0gQ5Dv2>I@Ju|6caAM2`LLi?sx$DvFD{`;74)l^qO%jWEg?pj6|@GZ_)EwK{JXx@0Z$N zf4I^K{`Mb*=RIovl%uxd%~jCN9K=Lk5-Kszl}FKi;>zIZOCFc z5jXePP*3zW3=X_8OB#dE_@Y(MPv<0vh3 z`!RI}r7Y&v*ZV|cC#l2Zcc>oSkvV!Vc7N|Sv@G{C>d?aSfLIn zq8(DM98BlPPCtnKUa);=5sISSAqDe8vU_l5J?Q(q9#960>LL&w5yr3hk?^Aa+M$}0 zy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;JVE5qT(NQYY*BVP+#$8L5q>LO_&MFQ{Tho+hwG)Tq={Y@YyIs^Emi6%9zX1s5l-qrZ$?LPV)#=dTgAQ z{O}0lu8BA&Y+&E8Sjr6fBxx?9hRVjNtF|j!Gk5G77t;bR%v4gQw%Ug%Wvx`F4IR^5 znuz7{YY_cD-Y7<+Avl*2q^a_t5I)7Iwi)%PuAm^EwHapAPN5!h@!DunyC^Ce(@QdS zaMG84&KPcj_T>8GSX!+)bn&Oj;o|RlUZ>0Z0rktCx7lw78Ajd2C1oP{JT)}Cw37cB z&=S}=?`Q!~HCBm;%5nAA0=aiY6)9}BoXA;H&{|o39kA4b%Ok7mVJ|JUx7A@5wGweMgn8QhDvnae{vA2g-~iyR%+) WiMX1r!*f*7s#}PYFLaeT#@_*I*~py$ literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/dygraph/__pycache__/trace_fc_fuse_pass.cpython-37.pyc b/x2paddle/optimizer/fusion/dygraph/__pycache__/trace_fc_fuse_pass.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b290ff5f3d50240ecaafe8a1105afc07d906da47 GIT binary patch literal 907 zcmZuvJ8u&~5Z=e#`LJw)B9JUm0Od74NR6T>NI{~oB0+(!Sys1e=ipxKo+WIV%4zc- zpyc0BZ-qp~U!Y=UFOH(%Jzx_qOhGdIY#dWgT)D$eF{#Kj4F~bMKi9L;+G@~dfY7Rk=((p z)QIK|JH!(6T+9JYAW}{t7Y>{`*efu5A6!Si(GB_Tr2=s}OPE0hE*7Gwi%tksVRbqG zLCih4`1>KP>Mpg*dL`?*tQXH;r0Hkcp?aB-QW&&oB2%+oA9fi{!wcH0l3`&BY_OkHTj%>+SwqYOXhAOJq6~q34 zKt6Lp*R&0&8dkE)FT|&!Rv;QvxIxouBRidN6XQPgG+l^=G+uu1@FlrWwr#n33`>jH zghq7z=q^nuR3C!b z2wcnp7IS|#OJXy>3Wfg(rLBe40wuash=vxgOLYiG4I( U{Ib`0e1Ke$`G~^DM>HP&1IP#AW&i*H literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/dygraph/__pycache__/trace_fc_fuser.cpython-37.pyc b/x2paddle/optimizer/fusion/dygraph/__pycache__/trace_fc_fuser.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..977dea8e6ae2bceafce14b8fd421ae4d5a5f6c87 GIT binary patch literal 3668 zcmb7H&2Qtz6`$dkC`$5roq9Lkpsf(JNtAe{)yD2_QadP8AVG`3D3BZir3Jy|P&OTk zVulnVDHO1Y4dl=|d+4D+b`jWZQM8vLxdlm({0lwxz*B(i+VQFP9@@S)LrIp3EnEs5 zzIpTJ&6_uGe(&kUO2s1ZeEsvk*>@iy(otI~MV=aH z9lfP@jFut#T2Oe6yiAzRjD5lkPu){nCZn&CTHzG5kgXcc%$Itx_o5SfH6<(k!eK1% zUgl1;Gw!_N3_K2U^l2BTj2|^8;x!;VVMyrr`OGof$1 zPc+ghfCnT`i!DLe$sqD-Mph2|&~v!$hs^6|dfbaV&JCPm+Q9S^+s?GWkCV)d zoFwsh7=sQi_JTHii?;0sP8{3zU&udy+318xBkqL*Cu}?6_O)i?_3P4gw%cXiq}S+Q zkAz1X-6-)p{?Ox%b}#n3VIw!Qk)R9gwrd05^J*C#h~$kyAhSgtM#kZ>-$}1u~555UpVxbz|?T{^q&WtybZxbvEB< zu2!%8sy3(mxvBDwlXQ9kXzt&5_WEjd0N=HnGxFzH@|N$!|Hp<=eAc4%YcL&Fey;jV zwOM_-dd@Y^D#=gmv){~}Sikw~*fb!|&geJSrhYil;DWb%OYX z`gkHobgNNr!e_WFqS@u1lXx(NgJOVd0soN046)HTD|CAa>^L4?Y6m@^)x|Z5rxDDT zK-Vd5t)_CsTYeduOv6|mR`Ph4Avv_#?p2}o>b068CT4VSiW@ma=p7a#?sw|oXZsY> z^o&AX_;pwq&!=Ls;o|&_8kTd8IIfzS>0*XhjbA~n+SE+`Jz!)S9^F<==V(M$#P!84 zGhMioSCDNuQRIaTY+8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RLnoLxwz05ETqzFwst&)RM~ZCY1U#af#b zDk_>f?F&u!3mvyBGXRuhFpG5%x;{Bfcf2bw@9x1>BnIv7$zcXZw&WAruy=Gr6;#KJ|fX+6K4{E9vq}@xG`PP{$O0(6rh}rxR{sT!#xI+e;s!oTd|@clgMBDBHGN zJ%rFAHlYz+Kl)F_-PLIlp}4iIv=DwMMAfJzXeazgh!0Cy{yhnB?!+*+A@4u9*am~( z1|Rc1FdKo3S-@i6?M;)|AMfNJU&}x4-(c6@(*wtScgB5pdM!>4Tw14(z7 c{?2|o4;Ag>r#<6mx3F^LF{1GC5sgQG0B$w*G5`Po literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/static/__pycache__/bn_scale_fuser.cpython-37.pyc b/x2paddle/optimizer/fusion/static/__pycache__/bn_scale_fuser.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6ec77e3a235cc351336ac5c5116aed88bf9c3be3 GIT binary patch literal 3692 zcmb_f&2JmW72nw}E-A`(6+4d66kyX77E_s$KqCN!C=K1%Bw7Q znb}>(WR^e@tH_~neCVM-69iIQ6z!!*uT7Es3q8-NKw>Eb`WN)lyf?F4k+SR*NS4^y znKy6Vd-I!lAH24>STo@H_b>iMUsy7X&v7t)Z0P(H-UJ(FFcKOa0$(#U`&P#yNV7t_ z?{u8L+i}&{4lA!1FB;5Y?vBA+Zr!#z9wXO{W@Q3WjEyFd-V0g6ulWgYnsVV~pRtg? zDEz^V>EI=Q$OZ6`r@FXg`dCFLc^W!gnbI-eGkSy(X6|?$i&@OxF*>$Z-f>ukc`$b0 zGi;+%0TZh7k?X0S23>k><9gQ*IT|9mq!5f>RDy5vC^V^&lH9m$Zkwp$4#6FQ7;8gT z*l-I?1}kf-L(}1aH!bNT*?iN;u+Qrpht!qGNH)gyXt=?K6D4bT~K^pXf5f`hyED7RhHBlQ{-Hd30JEB15 zqBR%_JXhRAVnSn((c{N#y*0J4!~pm1!23MB$r2!Yc#{S*AUw-!S;& zx6e-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RR91 literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/static/__pycache__/conv2d_add_fuse_pass.cpython-37.pyc b/x2paddle/optimizer/fusion/static/__pycache__/conv2d_add_fuse_pass.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..be02a72df40c558b60425d3f113a96d0c28857ca GIT binary patch literal 948 zcmZ`%O^?$s5Vf6;hN=Y)E3wiF(Q7UV^o-E5i$LN~t+W^9i)F=bH;|;kPFJ)lr|y;i z07w1}XP=Nb@fSET=`KQiyV8J~^ELjvRH+aH35g#5zAenb$Qg4r{0iYQu< znsQ1pW)-Ug9{4z@!aCv+B|3UTRH&jGq9RRq!H)7+$2-CYD!wG?;5XzUDRtq6v=-*0 z%T9J>alUM>r>|Zr^?GHsf&Fm{=fdbkX*+ES{A)iL1gBtj0!|Z772!-#9w?@Q8^XgL zpGQ5SdvpK-(cOvl*rGsiC8Sbf4)6k@3ku0`;2eORgW3DwI`Wln$v0mEP()`bGf2rL zLX=I}34!vguIAr~xd#V-WL`I2Zdc7(Hgnl5o<7UpO)mhh(txe>?JEB?ZT)t>Y`d~9 zH`?UDs9ZLAPc=V8HEY*q0652B7MT#bncSf{+jA`ZMYxOFpzFOpOwo}Y`OLQLJ>618 z75l=l!=N;nxlpTx26@9;cEy$WP&NwGV+uD|w%W)}r-4au9W9J(uUv!`HNFnL!?)%l z*|ydC1VW40gvNC9_%6!+?ktV5z>Tc65N;?$y;LixpKv1~KCWc-?K_)7*7sd^I2-y$OY5` cReMZ>91gK`$@5;~iw8&*iH|6J!H6cKzso%EdH?_b literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/static/__pycache__/conv2d_add_fuser.cpython-37.pyc b/x2paddle/optimizer/fusion/static/__pycache__/conv2d_add_fuser.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d4f68697174b557131550c35a47a7535c0cbe9b7 GIT binary patch literal 4323 zcmd@X-;W!`d1iOLUi<9JB@Kj#mRbmUw_xn^k*6v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I%BQLRLQQ%RMoY(6@)F@t% zJUM!Z*2WLfT9(kPG{l6!jNN)^KjBh z_;l}p*$7H%nr7ys!G?s_K*e(fPKX960WqGU=Pr7vkZ8Yd%XQYq^A4pkj|{ Zki#LCE`HKWe0mG1BJmN0kB?|P`U@--=Q;oY literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/static/__pycache__/prelu_fuser.cpython-37.pyc b/x2paddle/optimizer/fusion/static/__pycache__/prelu_fuser.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6cf4ac5263870fdf5ef8b44bc31a614048d10dac GIT binary patch literal 4088 zcma)9O>7&-72erDE|;XF%C>AdMxd%cHUpdbaSAwvQ<{*FUqyy+qach6l&7KmO=~6+|=qNN^U7tYaf!8UJ3i9eJ)HBn*C9J_(=4gei4GmAd+#(j=5n zb<3)2RHOQqQrD?LO}q_SpcdZddy1~q3$Un|PTY#z$ZOnujlKGFVFhoHT&j2r4dMym zEG1GRk|>+%nkwXP6R}&!(3Vp(ltN&ky&~*(qHc#(wbTgX4&%H4=G1Z=FYqGA0hJyy zzlnFzaT>lGhK}BD=j4Qv~3UQi0NU&0g4z!lP^ zN*@kbQ`QL8JS8Di-y|!98rvFCa=0ns1qm+zXVK!eF~r)mM9UrlXXOaz*bp~<1UEs; z-~pU|>q8Z@$s-geGHWtiPIdBFDnLO63v;SdN2sQNhkY1<%c)KuqEhJ@u@gEi!{98! z;FlD_Z-4!VclJK`d~f^XNAGXR^LY5dXOBMp?cPUQU%vgWJ(K@3 z%wON#`{VAzzdz`7qt$ls@Gl=d`pqX_efqmcJMTRD{olU&?AJdW(hIgmJ9z7P$Mrj_ zZaA|vlf^bbrMu%%o}5Y$8z=g`_q?Erd%=)zmBAG4+T+I+QojIFKMcNU!P z$k=A=`%ktEb~QcUcLqX#aGcE75aJ_&u&WsdjR;BL`ZW>$7dDo%ZC&@=@I^|Glkwu+ z#~kS14ZjIb7~h53rXPE>=8L)%)|k&)EQs!VA#;E}Eal=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v2d_add_fuse_pass.cpython-37.pyc b/x2paddle/optimizer/fusion/static/__pycache__/static_conv2d_add_fuse_pass.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..00da1e3b5bffffaf8dcae166a390b184e18f2671 GIT binary patch literal 955 zcmZ`%&2AGh5VpNPS)v3uRH9Oa$aODS$Qhy1R&a|d^@4n{thJLY>~0o&Q;{f~(re!V zj=TyIFW@UDUV#%c-lpP^dNt#}+4;Wt#%IG}pTMYo{t`SS#m^}lhh@vH_ zD5n(HtYlTd1HTT+u!?v@iH_bA6{_fls7TXYu%kTI@s9AGimyo8`vZAMN?mvS%mVBdI^4)6y713$R3{rB5 z5Jg?ILST7Tm$M(lJc5hAi>#{K%&zLStY@;GzkHQ_m|Ox}sR3K*`(5^B()iEk`s+y_D|mI%%7%ES~c*^#eo%RbUA zRaCKChK+`TgQ*L(nro=CU&%IKh)+eWKm<(Tddo%|+3GYf3GSo0kl0X7#3nSRo97Qv_Oa76MxAR}X(3!+h-#@;Afs>tAwI8Ud3O`y?By^|A@P5} z*b#&12H*A(n2o_DEM!UG&!%bOj`y7y-*;l%y+{;{j}BaSjT(22>cn_)Ak1f}WG&~Q e2UhJd4RScd(j~9E65l+52#drA6uw|Ulfgfk3i9#* literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/static/__pycache__/tf_batchnorm_fuse_pass.cpython-37.pyc b/x2paddle/optimizer/fusion/static/__pycache__/tf_batchnorm_fuse_pass.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..67a565f667bd59f180c17d1887735f0fe8290900 GIT binary patch literal 960 zcmZ`%J#Q015Z#Zv^I_RQflv@aiRiBJLFx!ajua#cD^e)XHLK-z?Ht?}yJrboPUW=x z2PpYB)LS7@@fWC=*~1Zqv)0Vc-j3(Jd9%~;ct~LVeDg!h144e`VYfmEPQmOHoFa;r zq@o$67_*X9JmWs*Wl)7#NQn+#6BVfNhNw`}E#J~C($SV=0~KA8Wbhm6kc7J6LRt&^ z!R!$@O){!T#uUxCVv668 zEa(|zVUOva>;*vv?wR%YqMM8N$e;!WVh$7p!siqKaN*9u&cN(_a2@$dH{_dF0{Wt} zgc+peVj+sU=!C!~tuE)^iMaQ)IbU)ciyD|enIsmiCh0yi$J3F83c;-G8vavsyf8Qe(>ByE` zvkm(|H&ju@zA&6MbjxQh&}yNf#bJf2iH}9CKmjb_22HDt>~z9SjOTD+WP9a8RMmJb zdWWyhg|cnS)l ViOwC_2J#5efBJgQ07`zS_n53qH5FtMdBk0KR%-I=r676_T&Hn literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/static/__pycache__/tf_batchnorm_fuser.cpython-37.pyc b/x2paddle/optimizer/fusion/static/__pycache__/tf_batchnorm_fuser.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8cd68941251d5383dae3b59339ec3604ce52d644 GIT binary patch literal 4768 zcmdTIOKcm*b!UHEE|-)n%lbHu?Yc$^x(#JJY2gM&5V(c|6oFd623!yc7AwwBUV6D) z%`R<;9Rf)tAcsP=f!-1$klLa@1Vwsnisar?(c_#7B(}qQPrbD7%`Pd6jhmu96s54U z^Zsw%&b;?VSE^N4gWq4i`zQa*S2gWZ1jauTCa=Jg-hhE>ltfxHf0L#TupSv*vuP5< z8Ijeso3@&pQK{=Roo=~VRbk6aKcF;Xuks+dH3nV_wipLKa;}9M#y_K&q%XpRX-z`4rv8rB zCX`Tp$7veWpyrO&G^s^xcw4kY9eCUCXr|UIfk$Pza6JpMuyy0wl^|=~TJ7;J`odeJ z(2Z}jgHL)AhD^(d(6;rCj#hRF(K2IO6Pj;Q4Ky07(oU61@Yh|(RruLf!s?c^(tg4? zFM$&2_*p`5{NQ39D!=bJ5lA$j24xv`42}12{ zvQB7e*C3k0Itp7>*fLPuUD#uaQpvet1S<6&=rF5JN!RF1jtvRCXQ!yS#UoSLxttS5 zpcHzKPVwZD^HW%q1RRXOUq~LC;>jf!rm%}312`CgzmQy-;+dn%hcq9bqGLP&2O~%p zI-W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A(V))?(?l!zl9a1W_NZZpsaQ75zGBCQ2+x!>AX7 z8!t2s|NI3UF5;lT7wa<|yDDiypi{Wi^>`+YFwS@b^`J6YW^|pUJ~S`V$){nQTfojj z+7J-Pf~t4n#}Q+}Es>|no%&K<_`iwT@B++VKn}>F(0D+i^YLEEzm0^Kkl>AWdeH3#2c*gqu&jjf0mWToS-}W-7$TgL_;YBv4E<6LOIP(cs%w<) zI9W?$Dp7ah38YEy35-~Oxn5Jt4+n4bSTL(Q-c!uDJJ8v!?Cie0BeJkv>?C55ef{2PFi zR^0DG>D1#yR$9F%V(N6Hd9gk-{x?Bm@^6Ah(LMTk<>eeZ-{!FiW2?tmBjG)$=UvsB naIL1E!)VH)L literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/fusion/static/bn_scale_fuser.py b/x2paddle/optimizer/fusion/static/bn_scale_fuser.py index 9ae04f7..05d1780 100644 --- a/x2paddle/optimizer/fusion/static/bn_scale_fuser.py +++ b/x2paddle/optimizer/fusion/static/bn_scale_fuser.py @@ -79,7 +79,6 @@ class Static_BNScaleFuser(FuseBase): graph.layers[new_layer_id] = new_layer matches.pop(new_layer_id) - def gen_new_layer(self, parameters, matches): layers_id = list(matches.keys()) layer = matches[layers_id[0]] diff --git a/x2paddle/optimizer/fusion/static/conv2d_add_fuse_pass.py b/x2paddle/optimizer/fusion/static/conv2d_add_fuse_pass.py new file mode 100644 index 0000000..ee51b4b --- /dev/null +++ b/x2paddle/optimizer/fusion/static/conv2d_add_fuse_pass.py @@ -0,0 +1,33 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License" +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from x2paddle.optimizer.pass_ import Pass +from x2paddle.optimizer.fusion.static import StaticConv2DAddFuser +from x2paddle.optimizer.pass_manager import pass_register + + +@pass_register +class StaticConv2DAddFusePass(Pass): + name = "static_conv2d_add_fuse_pass" + + def __init__(self): + Pass.__init__(self) + + def apply(self, graph): + fuser = StaticConv2DAddFuser() + fuser.operate(graph, match_kind="edge") + + +# 用于注册 +static_conv2d_add_fuse_pass = StaticConv2DAddFusePass() \ No newline at end of file diff --git a/x2paddle/optimizer/fusion/static/conv2d_add_fuser.py b/x2paddle/optimizer/fusion/static/conv2d_add_fuser.py new file mode 100644 index 0000000..cb3912f --- /dev/null +++ b/x2paddle/optimizer/fusion/static/conv2d_add_fuser.py @@ -0,0 +1,121 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License" +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import copy +import numpy as np +from x2paddle.optimizer.pattern_matcher import FuseBase +from x2paddle.core.program import PaddleGraph, PaddleLayer +from x2paddle.core.util import * + + +class StaticConv2DAddFuser(FuseBase): + def __init__(self): + super(StaticConv2DAddFuser, self).__init__(graph_type="static") + self.patterns = list() + + def build_pattern(self): + """ 描述需要替换的conv2d+add图结构。 + conv2d+add层模式python实现代码示例: + 模式一: + MobilenetV1_Logits_Conv2d_1c_1x1_biases = paddle.static.create_parameter(dtype='float32', shape=[1001], name='MobilenetV1_Logits_Conv2d_1c_1x1_biases', default_initializer=paddle.nn.initializer.Constant(value=0.0)) + conv2d_transpose_14 = paddle.transpose(x=MobilenetV1_Logits_AvgPool_1a_AvgPool, perm=[0, 3, 1, 2]) + MobilenetV1_Logits_Conv2d_1c_1x1_Conv2D = paddle.nn.functional.conv2d(x=conv2d_transpose_14, weight=MobilenetV1_Logits_Conv2d_1c_1x1_weights, bias=None, stride=[1, 1], dilation=[1, 1], padding='SAME') + MobilenetV1_Logits_Conv2d_1c_1x1_Conv2D = paddle.transpose(x=MobilenetV1_Logits_Conv2d_1c_1x1_Conv2D, perm=[0, 2, 3, 1]) + MobilenetV1_Logits_Conv2d_1c_1x1_BiasAdd = paddle.add(x=MobilenetV1_Logits_Conv2d_1c_1x1_Conv2D, y=MobilenetV1_Logits_Conv2d_1c_1x1_biases) + + 模式二: + MobilenetV1_Logits_Conv2d_1c_1x1_biases = paddle.static.create_parameter(dtype='float32', shape=[1001], name='MobilenetV1_Logits_Conv2d_1c_1x1_biases', default_initializer=paddle.nn.initializer.Constant(value=0.0)) + MobilenetV1_Logits_Conv2d_1c_1x1_Conv2D = paddle.nn.functional.conv2d(x=conv2d_transpose_14, weight=MobilenetV1_Logits_Conv2d_1c_1x1_weights, bias=None, stride=[1, 1], dilation=[1, 1], padding='SAME') + MobilenetV1_Logits_Conv2d_1c_1x1_BiasAdd = paddle.add(x=MobilenetV1_Logits_Conv2d_1c_1x1_Conv2D, y=MobilenetV1_Logits_Conv2d_1c_1x1_biases) + """ + + def gen_name(id): + return "x" + str(id) + + pattern = PaddleGraph(graph_type="dygraph") + pattern.add_layer( + "paddle.static.create_parameter", + inputs={}, + outputs=[gen_name(0)]) + pattern.add_layer( + kernel="paddle.transpose", + inputs={"x": "conv-input-0"}, + outputs=[gen_name(1)], + perm=[0, 3, 1, 2]) + pattern.add_layer( + kernel="paddle.nn.functional.conv2d", + inputs={"input": gen_name(1), + "weight": "conv-input-1"}, + outputs=[gen_name(2)]) + pattern.add_layer( + kernel="paddle.transpose", + inputs={"x": gen_name(2)}, + outputs=[gen_name(2)], + perm=[0, 2, 3, 1]) + pattern.add_layer( + kernel="paddle.add", + inputs={"x": gen_name(2), + "y": gen_name(0)}, + outputs=[gen_name(3)]) + pattern.build(inputs={"input-0": "conv-input-0", + "input-1": "conv-input-1"}) + self.patterns.append(pattern) + + pattern = PaddleGraph(graph_type="dygraph") + pattern.add_layer( + "paddle.static.create_parameter", + inputs={}, + outputs=[gen_name(0)]) + pattern.add_layer( + kernel="paddle.nn.functional.conv2d", + inputs={"input": "conv-input-0", + "weight": "conv-input-1"}, + outputs=[gen_name(1)]) + pattern.add_layer( + kernel="paddle.add", + inputs={"x": gen_name(1), + "y": gen_name(0)}, + outputs=[gen_name(2)]) + pattern.build(inputs={"input-0": "conv-input-0", + "input-1": "conv-input-1"}) + self.patterns.append(pattern) + + def insert_new_layer(self, graph, parameters, matches): + self.gen_new_layer(matches, graph) + matches_copy = copy.deepcopy(matches) + for layer_id, layer in matches_copy.items(): + if layer.kernel not in ["paddle.add"]: + matches.pop(layer_id) + + def gen_new_layer(self, matches, graph): + is_transpose = False + for layer_id, layer in matches.items(): + if layer.kernel == "paddle.static.create_parameter": + bias_name = layer.attrs["name"][1: -1] + if layer.kernel == "paddle.transpose": + is_transpose = True + if layer.kernel == "paddle.add": + output_name = layer.outputs[0] + if layer.kernel == "paddle.nn.functional.conv2d": + conv_id = layer_id + for layer_id, layer in matches.items(): + if layer.kernel == "paddle.nn.functional.conv2d": + layer.inputs["bias"] = bias_name + layer.attrs.pop("bias") + if not is_transpose: + layer.outputs[0] = output_name + if layer.kernel == "paddle.transpose": + if conv_id in graph.edges_in[layer_id]: + layer.outputs[0] = output_name + diff --git a/x2paddle/optimizer/fusion/static/prelu_fuse_pass.py b/x2paddle/optimizer/fusion/static/prelu_fuse_pass.py new file mode 100644 index 0000000..bdd65e8 --- /dev/null +++ b/x2paddle/optimizer/fusion/static/prelu_fuse_pass.py @@ -0,0 +1,33 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License" +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from x2paddle.optimizer.pass_ import Pass +from x2paddle.optimizer.fusion.static import StaticPReLUFuser +from x2paddle.optimizer.pass_manager import pass_register + + +@pass_register +class StaticPReLUFusePass(Pass): + name = "static_prelu_fuse_pass" + + def __init__(self): + Pass.__init__(self) + + def apply(self, graph): + fuser = StaticPReLUFuser() + fuser.operate(graph, match_kind="edge") + + +# 用于注册 +static_prelu_fuse_pass = StaticPReLUFusePass() \ No newline at end of file diff --git a/x2paddle/optimizer/fusion/static/prelu_fuser.py b/x2paddle/optimizer/fusion/static/prelu_fuser.py new file mode 100644 index 0000000..c87abdf --- /dev/null +++ b/x2paddle/optimizer/fusion/static/prelu_fuser.py @@ -0,0 +1,139 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License" +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import copy +import numpy as np +from collections import OrderedDict +from x2paddle.optimizer.pattern_matcher import FuseBase +from x2paddle.core.program import PaddleGraph, PaddleLayer +from x2paddle.core.util import * + + +class StaticPReLUFuser(FuseBase): + def __init__(self): + super(StaticPReLUFuser, self).__init__(graph_type="static") + + def build_pattern(self): + """ 描述需要替换的prelu图结构。 + prelu层模式python实现代码示例: + conv4_alphas = paddle.static.create_parameter(dtype='float32', shape=[128], name='conv4_alphas', default_initializer=paddle.nn.initializer.Constant(value=0.0)) + conv4_mul_1_y = paddle.full(dtype='float32', shape=[1], fill_value=0.5) + conv4_Relu = paddle.nn.functional.relu(x=conv4_BiasAdd) + conv4_Abs = paddle.abs(x=conv4_BiasAdd) + conv4_sub = fluid.layers.elementwise_sub(x=conv4_BiasAdd, y=conv4_Abs) + conv4_mul = paddle.multiply(x=conv4_alphas, y=conv4_sub) + conv4_mul_1 = paddle.multiply(x=conv4_mul, y=conv4_mul_1_y) + conv4_add = paddle.add(x=conv4_Relu, y=conv4_mul_1) + """ + + def gen_name(id): + return "x" + str(id) + + self.pattern.add_layer( + "paddle.static.create_parameter", + inputs={}, + outputs=[gen_name(0)]) + self.pattern.add_layer( + "paddle.full", + inputs={}, + outputs=[gen_name(1)], + shape=[1], + fill_value=0.5) + self.pattern.add_layer( + "paddle.nn.functional.relu", + inputs={"x": "prelu-input-0"}, + outputs=[gen_name(2)]) + self.pattern.add_layer( + "paddle.abs", + inputs={"x": "prelu-input-0"}, + outputs=[gen_name(3)]) + self.pattern.add_layer( + "fluid.layers.elementwise_sub", + inputs={"x": "prelu-input-0", + "y": gen_name(3)}, + outputs=[gen_name(4)]) + self.pattern.add_layer( + "paddle.multiply", + inputs={"x": gen_name(0), + "y": gen_name(4)}, + outputs=[gen_name(5)]) + self.pattern.add_layer( + "paddle.multiply", + inputs={"x": gen_name(5), + "y": gen_name(1)}, + outputs=[gen_name(6)]) + self.pattern.add_layer( + "paddle.add", + inputs={"x": gen_name(2), + "y": gen_name(6)}, + outputs=[gen_name(7)]) + self.pattern.build(inputs={"input-0": "prelu-input-0", }) + + + def insert_new_layer(self, graph, parameters, matches): + new_layers, last_layer_id = self.gen_new_layer(matches, parameters, graph) + matches_copy = copy.deepcopy(matches) + for layer_id, layer in matches_copy.items(): + for i in range(4): + if layer_id == new_layers[i].id: + matches.pop(new_layers[i].id) + prefix_layers = OrderedDict() + mid_layers = OrderedDict() + suffix_layers = OrderedDict() + is_need_id = False + for layer_id, layer in graph.layers.items(): + if is_need_id: + suffix_layers[layer_id] = layer + else: + if layer_id == last_layer_id: + for i in range(4): + mid_layers[new_layers[i].id] = new_layers[i] + is_need_id = True + prefix_layers[layer_id] = layer + prefix_layers.update(mid_layers) + prefix_layers.update(suffix_layers) + graph.layers = prefix_layers + + def gen_new_layer(self, matches, parameters, graph): + layer_id_list = list(matches.keys()) + layer_id_list.sort(key = int) + for layer_id, layer in matches.items(): + if layer.kernel == "paddle.nn.functional.relu": + input_name = layer.inputs["x"] + if layer.kernel == "paddle.static.create_parameter": + param_layer = layer + param_name = layer.outputs[0] + if layer.kernel == "paddle.add": + output_name = layer.outputs[0] + transpose0 = PaddleLayer( + id=layer_id_list[-1] + "_1", + kernel="paddle.transpose", + inputs={"x": input_name}, + outputs=["{}_transpose_for_prelu".format(input_name)], + perm=[0, 3, 1, 2]) + param = parameters[param_name] + c = param.shape[0] + prelu = PaddleLayer(id=layer_id_list[-1] + "_2", + kernel="paddle.nn.functional.prelu", + inputs={"x": "{}_transpose_for_prelu".format(input_name), + "weight": param_name}, + outputs=["{}_prelu".format(input_name)]) + transpose1 = PaddleLayer( + id=layer_id_list[-1] + "_3", + kernel="paddle.transpose", + inputs={"x": "{}_prelu".format(input_name)}, + outputs=[output_name], + perm=[0, 2, 3, 1]) + return [param_layer, transpose0, prelu, transpose1], layer_id_list[-1] + diff --git a/x2paddle/optimizer/fusion/static/tf_batchnorm_fuse_pass.py b/x2paddle/optimizer/fusion/static/tf_batchnorm_fuse_pass.py new file mode 100644 index 0000000..36d58ba --- /dev/null +++ b/x2paddle/optimizer/fusion/static/tf_batchnorm_fuse_pass.py @@ -0,0 +1,33 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License" +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from x2paddle.optimizer.pass_ import Pass +from x2paddle.optimizer.fusion.static import StaticTFBatchNormFuser +from x2paddle.optimizer.pass_manager import pass_register + + +@pass_register +class StaticTFBatchNormFusePass(Pass): + name = "static_tf_batchnorm_fuse_pass" + + def __init__(self): + Pass.__init__(self) + + def apply(self, graph): + fuser = StaticTFBatchNormFuser() + fuser.operate(graph, match_kind="edge") + + +# 用于注册 +static_tf_batchnorm_fuse_pass = StaticTFBatchNormFusePass() \ No newline at end of file diff --git a/x2paddle/optimizer/fusion/static/tf_batchnorm_fuser.py b/x2paddle/optimizer/fusion/static/tf_batchnorm_fuser.py new file mode 100644 index 0000000..796556b --- /dev/null +++ b/x2paddle/optimizer/fusion/static/tf_batchnorm_fuser.py @@ -0,0 +1,227 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License" +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import copy +import numpy as np +from collections import OrderedDict +from x2paddle.optimizer.pattern_matcher import FuseBase +from x2paddle.core.program import PaddleGraph, PaddleLayer +from x2paddle.core.util import * + + +class StaticTFBatchNormFuser(FuseBase): + def __init__(self): + super(StaticTFBatchNormFuser, self).__init__(graph_type="static") + self.patterns = list() + + def build_pattern(self): + """ 描述需要替换的batchnorm图结构。 + batchnorm层模式python实现代码示例: + + """ + + def gen_name(id): + return "x" + str(id) + + pattern = PaddleGraph(graph_type="dygraph") + pattern.add_layer( + "paddle.static.create_parameter", + inputs={}, + outputs=[gen_name(0)]) + pattern.add_layer( + "paddle.full", + inputs={}, + outputs=[gen_name(1)], + shape=[1]) + pattern.add_layer( + "paddle.add", + inputs={"x": gen_name(0), "y": gen_name(1)}, + outputs=[gen_name(2)]) + pattern.add_layer( + "paddle.rsqrt", + inputs={"x": gen_name(2)}, + outputs=[gen_name(3)]) + pattern.add_layer( + "paddle.static.create_parameter", + inputs={}, + outputs=[gen_name(4)]) + pattern.add_layer( + "paddle.multiply", + inputs={"x": gen_name(3), "y": gen_name(4)}, + outputs=[gen_name(5)]) + pattern.add_layer( + "paddle.static.create_parameter", + inputs={}, + outputs=[gen_name(6)]) + pattern.add_layer( + "paddle.multiply", + inputs={"x": gen_name(6), "y": gen_name(5)}, + outputs=[gen_name(7)]) + pattern.add_layer( + "paddle.static.create_parameter", + inputs={}, + outputs=[gen_name(8)]) + pattern.add_layer( + "fluid.layers.elementwise_sub", + inputs={"x": gen_name(8), "y": gen_name(7)}, + outputs=[gen_name(9)]) + pattern.add_layer( + "paddle.multiply", + inputs={"x": "bn-input-0", "y": gen_name(5)}, + outputs=[gen_name(10)]) + pattern.add_layer( + "paddle.add", + inputs={"x": gen_name(10), "y": gen_name(9)}, + outputs=[gen_name(11)]) + pattern.build(inputs={"input-0": "bn-input-0", }) + self.patterns.append(pattern) + + pattern = PaddleGraph(graph_type="dygraph") + pattern.add_layer( + "paddle.static.create_parameter", + inputs={}, + outputs=[gen_name(0)]) + pattern.add_layer( + "paddle.full", + inputs={}, + outputs=[gen_name(1)], + shape=[1]) + pattern.add_layer( + "paddle.add", + inputs={"x": gen_name(0), "y": gen_name(1)}, + outputs=[gen_name(2)]) + pattern.add_layer( + "paddle.rsqrt", + inputs={"x": gen_name(2)}, + outputs=[gen_name(3)]) + pattern.add_layer( + "paddle.static.create_parameter", + inputs={}, + outputs=[gen_name(4)]) + pattern.add_layer( + "paddle.multiply", + inputs={"x": gen_name(3), "y": gen_name(4)}, + outputs=[gen_name(5)]) + pattern.add_layer( + "paddle.multiply", + inputs={"x": "bn-input-0", "y": gen_name(5)}, + outputs=[gen_name(10)]) + pattern.add_layer( + "paddle.static.create_parameter", + inputs={}, + outputs=[gen_name(6)]) + pattern.add_layer( + "paddle.multiply", + inputs={"x": gen_name(6), "y": gen_name(5)}, + outputs=[gen_name(7)]) + pattern.add_layer( + "paddle.static.create_parameter", + inputs={}, + outputs=[gen_name(8)]) + pattern.add_layer( + "fluid.layers.elementwise_sub", + inputs={"x": gen_name(8), "y": gen_name(7)}, + outputs=[gen_name(9)]) + pattern.add_layer( + "paddle.add", + inputs={"x": gen_name(10), "y": gen_name(9)}, + outputs=[gen_name(11)]) + pattern.build(inputs={"input-0": "bn-input-0", }) + self.patterns.append(pattern) + + def insert_new_layer(self, graph, parameters, matches): + new_layers, last_layer_id = self.gen_new_layer(matches, parameters, graph) + matches_copy = copy.deepcopy(matches) + for layer_id, layer in matches_copy.items(): + for i in range(7): + if layer_id == new_layers[i].id: + matches.pop(new_layers[i].id) + prefix_layers = OrderedDict() + mid_layers = OrderedDict() + suffix_layers = OrderedDict() + is_need_id = False + for layer_id, layer in graph.layers.items(): + if is_need_id: + suffix_layers[layer_id] = layer + else: + if layer_id == last_layer_id: + for i in range(7): + mid_layers[new_layers[i].id] = new_layers[i] + is_need_id = True + prefix_layers[layer_id] = layer + prefix_layers.update(mid_layers) + prefix_layers.update(suffix_layers) + graph.layers = prefix_layers + + def gen_new_layer(self, matches, parameters, graph): + layer_id_list = list(matches.keys()) + layer_id_list.sort(key = int) + for layer_id, layer in matches.items(): + if layer.kernel == "paddle.full": + full_layer = layer + out_layer_id = graph.edges_out[layer_id][0] + if matches[out_layer_id].kernel == "paddle.add": + var_layer_id = graph.edges_in[out_layer_id][0] + var_layer = matches[var_layer_id] + if layer.kernel == "paddle.rsqrt": + out_layer_id = graph.edges_out[layer_id][0] + if matches[out_layer_id].kernel == "paddle.multiply": + gamma_layer_id = graph.edges_in[out_layer_id][1] + gamma_layer = matches[gamma_layer_id] + if layer.kernel == "fluid.layers.elementwise_sub": + in_layer_id = graph.edges_in[layer_id][0] + beta_layer = matches[in_layer_id] + in_layer_id = graph.edges_in[layer_id][1] + in_layer_id = graph.edges_in[in_layer_id][0] + mean_layer = matches[in_layer_id] + out_layer_id = graph.edges_out[layer_id][0] + add_layer = matches[out_layer_id] + if layer.kernel == "paddle.multiply": + in_layer_id = graph.edges_in[layer_id][1] + mul_layer = matches[in_layer_id] + if mul_layer.kernel == "paddle.multiply": + in_layer_id = graph.edges_in[layer_id][0] + if in_layer_id not in matches: + input_name = layer.inputs["x"] + transpose0 = PaddleLayer( + id=layer_id_list[-1] + "_1", + kernel="paddle.transpose", + inputs={"x": input_name}, + outputs=["{}_transpose_for_bn".format(input_name)], + perm=[0, 3, 1, 2]) + params = parameters[gamma_layer.outputs[0]] + c = params.shape[0] + bn = PaddleLayer( + id=layer_id_list[-1] + "_2", + kernel="paddle.nn.functional.batch_norm", + inputs={"x": "{}_transpose_for_bn".format(input_name), + "running_mean": mean_layer.outputs[0], + "running_var": var_layer.outputs[0], + "weight": gamma_layer.outputs[0], + "bias": beta_layer.outputs[0]}, + outputs=["{}_bn".format(input_name)], + epsilon=full_layer.attrs["fill_value"]) + transpose1 = PaddleLayer( + id=layer_id_list[-1] + "_3", + kernel="paddle.transpose", + inputs={"x": "{}_bn".format(input_name)}, + outputs=add_layer.outputs, + perm=[0, 2, 3, 1]) + mean_layer.id = layer_id_list[-1] + "_01" + var_layer.id = layer_id_list[-1] + "_02" + gamma_layer.id = layer_id_list[-1] + "_03" + beta_layer.id = layer_id_list[-1] + "_04" + return [mean_layer, var_layer, gamma_layer, beta_layer, + transpose0, bn, transpose1], layer_id_list[-1] + diff --git a/x2paddle/optimizer/optimizer.py b/x2paddle/optimizer/optimizer.py index 69deedd..30557f6 100644 --- a/x2paddle/optimizer/optimizer.py +++ b/x2paddle/optimizer/optimizer.py @@ -16,13 +16,13 @@ from x2paddle.optimizer.pass_manager import PassManager from x2paddle.optimizer.fusion.dygraph import * from x2paddle.optimizer.fusion.static import * from x2paddle.optimizer.elimination.dygraph import * +from x2paddle.optimizer.elimination.static import * class GraphOptimizer(object): def __init__(self, source_frame, paddle_type="dygraph", jit_type="trace"): if source_frame == "pytorch": if jit_type == "trace": - self.passes = ["dygraph_constant_fuse_pass", - "trace_fc_fuse_pass"] + self.passes = ["trace_fc_fuse_pass"] else: self.passes = [ "dygraph_constant_fuse_pass", @@ -39,12 +39,20 @@ class GraphOptimizer(object): else: self.passes = ["static_bn_scale_fuse_pass"] elif source_frame == "tf": - self.passes = [ - "dygraph_conv2d_add_fuse_pass", - "dygraph_tf_batchnorm_fuse_pass", - "dygraph_prelu_fuse_pass", - "transpose_eliminate_pass" - ] + if paddle_type == "dygraph": + self.passes = [ + "dygraph_conv2d_add_fuse_pass", + "dygraph_tf_batchnorm_fuse_pass", + "dygraph_prelu_fuse_pass", + "transpose_eliminate_pass" + ] + else: + self.passes = [ + "static_conv2d_add_fuse_pass", + "static_tf_batchnorm_fuse_pass", + "static_prelu_fuse_pass", + "static_transpose_eliminate_pass" + ] else: self.passes = [] diff --git a/x2paddle/optimizer/tensorflow/__pycache__/__init__.cpython-37.pyc b/x2paddle/optimizer/tensorflow/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ac7f8f6b99bc543360a207ecc049ba4d6cb78cd5 GIT binary patch literal 169 zcmZ?b<>g`kg5Xyt<3aRe5CH>>K!yVl7qb9~6oz01O-8?!3`HPe1o10KKR2&LzqmB7 zGBGbLF)!V~P(Q*bATcE+CpA7fKP45;)2}cp01NBq7nEe?W>%#Z>6fJD73UYF<>Z&^ f$H!;pWtPOp>lIYq;;_lhPbtkwwFBAp8HgDG1&l0D literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/tensorflow/__pycache__/batch_norm.cpython-37.pyc b/x2paddle/optimizer/tensorflow/__pycache__/batch_norm.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c70b0cd7a274e10c9dfa06ce816cccdcf2fa4bab GIT binary patch literal 3649 zcmaJ^&2QYs73c74x!e`CT1&E5mL2&kfi9A*q()J=L68dVrBDJSs0*S7LG6rIlt}Js z$d%;{_fqB1O9~x|9t-K%YvDhj=%GMwMUm578x&9vMbAAnd2cwo;>Jn{4Ees_@4fjT z`QhB0tHJfjzy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~F&jc(4wz522cmh=+VaTpKT z$b9Fs@jL5vjvo!Yg|`K~wc#deY>-89KNYSlG6?gWi~4R9W+mB5`o~e)3lbKlK?+?E zi%N1F@+eHZOiI@mg*D(&nhUer$L|`-*g#TtIfno#XGtd03k$Pk!sxMFIE?mK246wK zh*>J?B@5M-_)1vV`%GBbehAfL8N$d|&T+;#t^i>}^O7(Z*6uKh>H6CoK8rMA^>{eg z=Xa5IB#r=DYe|aNLF&7*Q6SA8`z|bzKo1u>L`YxcJ@=vb5k~x0H3WE<* z{8PxD$}en(G|4h?iB3GyBD(Iv(}TN?GF{3_4Os!%s+55Rc%jGQcgxV0wB_)w_mUQ% zQ&wfZNoeJj?ZPFTw=<~9mvxJ8tMm)PHdnZ?1QRM zpX!@nw@gN@nG+Ejx&sFT{4L-X3LDHwg80lsZ91X*`)NltH&wq%w>Ay=!;nZ;a z%fYQ7e|H?>7*eusbNq=CFzs>7x_Jc0m)ug!8P# O_C8L3hUu^=P2(FwwW}fk literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/tensorflow/__pycache__/bias.cpython-37.pyc b/x2paddle/optimizer/tensorflow/__pycache__/bias.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..263afc63abbb8483f0870c64d0cff2c5a254197b GIT binary patch literal 1798 zcmZuxy>BB$6rYdX_4+f03sG_kQd$GDAtj1VQ8*o)Iq8a=ETYxonK)~&*Xx<}onx&V zaurp|D;xea$2fTQBwf#&DthGjJ3~ie(!r`-aD(;D+Jc7-+u`{tr7AYZZ?Yp za|)k+3Pcb=W6~pE6Tt+3M+CoNJu2uc(sJ%WPP%=ho5g@Rg-;&>kpwhJj|nQ+JJREV z3kUuk;exeiN@r21ze%$`1zlYDj}E?qPd9*|;eh2NfHc5_cNb4C<5?uyad<72Zuck2 zn`5!~_ahiIy#Ds;C$gMzD3Xj4yv8%7qYrc01!F>*!f>9VVAyGWh(9&gz(xmR%&@vL#Mp(96Fm1;^&IltCxBpdo|mj2AGCj6`vGL> zLvH@CD#{1M=Ec^a=L2dr8~G~%elzSyLtIJxp=Xx&YxNRD)`zd?)>5txbfPup4T_G zID$8!c60Cqr)@R!+6lak>FznXrPII8$y$aPK~%_S`$E8`w!L?6t%nsAdWBE4+Y!wZ zGCevky6=PTVi&sAzWgtbHV?YpUhF+;zir>$V>>G(i^E46GL~bRWN#xa186AYg!4$> z{|)QEovdV-$si3?IF^}I#?@D0Dvgs$HNM9Vy2n{%%Gi5Bm}TmPaT3rqblz$jH&s!R z8K*zNwiHsPmh*}^VB9E^V{N>VREdn0^~7VDn6eZDse{QZGkhR3QvxoXW!ktHLL0x3 zM+vw{gq)kQka00xj29)S+G;2VGjj(jOs~{O$on>K5DDX2u2%!Ug&Bg?DA{g$bz9Na zpz`l_ErN5y1a)txsJ+-iXu~mYIx_T)oo@xf31hgLB{=o)}Rg` zjP3(pp&u4I%Q3nOSPdn#fjn4QJ&W)2JwThZLMx#C6u3j$1P-x9^{kljZHV1%xi}s1 zf`Y(Qf?zxmGnlf0sRhAw7RH4{l^{FSLV_do0l_L1UOS$xM&eW7wMdJpCmZPl3+uoZ Q@1GRWp5cSEW7+5b0O7C72><{9 literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/tensorflow/__pycache__/prelu.cpython-37.pyc b/x2paddle/optimizer/tensorflow/__pycache__/prelu.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b65008fa6087a2a94da867002140978f4fe55e37 GIT binary patch literal 2861 zcmaJ@&2Jk;6yMn|uQ$%taT4dFMd|^mghRfNDg*^pP{E~Y5nn|X)oSaRxSOoko7r)j zy6X$!zy&En`~k_48;AZAaN>yOzy%2@h`)dX@SE9b|$ZwZ#> z1HP9G9&crwCBx0^iS)uSPGb>skYd_&}b>(3Z(s*5JQkt zvmpD{85x@=_R-D4Jhjh^TgHiffA>psY>n;0-gl^ZVDamRS3$d{HIhR;A z)=IxUW^{-$rTeQwb%90s@Zh1u;%j7n#m!Y*iMmnD0h@ndoe;hYFO3o@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-vF;hK$b9HDMzLKUma;ptd$-XmPuB192H-Uz*NsRD4*CGkB5~F z&_D%^NnFsbj%ZFa4XjZ3uai+@(j~CLJGdD5(n)b4!%+HRh!P$qif)AA;V?={4ObsQ z{B1Q&KDkOtrHVV46rsP;JmOhevQg)25K1Q<_OmDanxb(+Ny54!Mu*_4UOUSd-(#EI p0cV>TAD|NZWf`|-bwd#++VlT`klu|F`@5=*<*HG}Ww literal 0 HcmV?d00001 diff --git a/x2paddle/optimizer/tensorflow/__pycache__/transpose.cpython-37.pyc b/x2paddle/optimizer/tensorflow/__pycache__/transpose.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4f71250e429d685c5c0cc5464a405527ff7195f9 GIT binary patch literal 5628 zcmbstOKcm*b!LBDQY1ymvMkApBe+Qs7KW5MKmw$W@cR7WeY?Gq!c|6JrqSz1QZYyXwX9sK@LTazO=}xhaC3WUK|ufk3}x+d$S*YBpC&| z#J-)G_vXDf@4b05kFOO9IRej}FaKI3S|VTnevcSRHiZwz8ce+0biYEfQuRC z-{!XGw_CpRR$EjlOvDGj1$e&$uYVT+azPF_n`LU5fLMf?EX#6ij^$Z_71=y1u?4os zF0iFq0q~SvWXtRlTd8T#Q`jn7W0%=Fdx~AD88D(U0vbHM-M_Hc=(=pPVIMf$->kO0 z_pY=4rK!PPTU75`UW+&TPfZ~rYD*-G=wF^fbH{i4j^#Nvv_yaXEaa}+aFJj}k9Moo z06i9`rnGGaV+&Jb+-Y=Y$Z+Vzerbx#-u3%SQzO1xYqnfAL+A9`v)ud+7yaewxer|b zzP0zl^%-S^?cMKRoF;AUiFTvw&zQ8~*!2VJ4CVJ4trnkEito)R<)Z>K26Y-v)A0mg z9Lr|x30S|o`vh#W+js(&x$pH?rdG%u)~z~L)3LpoMaCGr(Ks8?w0mbGZ13P~gx_tR zExpZKtgKb?Zqu$gRus%(fw|nNiln>9E3QL>(Sg!? zE};8lL{G?f$-T9Alz}?X0&QPmN?qZl0CLGoWT13PJ0wsrn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