From 32eaafe0dab9e9ecefa49615fe7863949b802b68 Mon Sep 17 00:00:00 2001 From: SunAhong1993 <48579383+SunAhong1993@users.noreply.github.com> Date: Mon, 5 Jul 2021 11:20:26 +0800 Subject: [PATCH] Update models inputs (#630) * Update stargan.md * fix the paddle_type * add docs * add docs * add acknowledge * fix the docs * fix the docs * add docs * fix * add docs * add docs * Update README.md * fix onnx inputs * fix * fix * remove * remove numpy input --- x2paddle/core/program.py | 19 ++++++++++++++++-- .../__pycache__/__init__.cpython-37.pyc | Bin 178 -> 0 bytes .../caffe_op_mapper.cpython-37.pyc | Bin 30280 -> 0 bytes .../op_mapper/caffe2paddle/caffe_op_mapper.py | 11 ++++------ .../op_mapper/onnx2paddle/opset9/opset.py | 6 ++---- x2paddle/op_mapper/tf2paddle/tf_op_mapper.py | 6 ++---- 6 files changed, 25 insertions(+), 17 deletions(-) delete mode 100644 x2paddle/op_mapper/caffe2paddle/__pycache__/__init__.cpython-37.pyc delete mode 100644 x2paddle/op_mapper/caffe2paddle/__pycache__/caffe_op_mapper.cpython-37.pyc diff --git a/x2paddle/core/program.py b/x2paddle/core/program.py index 7b155bd..097f1f5 100644 --- a/x2paddle/core/program.py +++ b/x2paddle/core/program.py @@ -220,6 +220,7 @@ class PaddleGraph(object): self.layers.pop(layer_id) self.get_inputs() + if len(self.outputs) == 0: self.get_outputs() @@ -293,8 +294,13 @@ class PaddleGraph(object): self.inputs.extend(block.inputs) update(self.layers) - self.inputs = list(set(self.inputs)) - if self.inputs is not None: + new_inputs = list() + for input_name in self.inputs: + if input_name in new_inputs: + continue + new_inputs.append(input_name) + self.inputs = new_inputs + if self.source_type == "pytorch" and self.inputs is not None: self.inputs.sort() def get_outputs(self): @@ -313,6 +319,15 @@ class PaddleGraph(object): self.outputs.append(output_name) def gen_code(self, code_dir=None, indent=2): + # 去除to_tensor的layer + invalid_list = list() + for layer_id, layer in self.layers.items(): + if layer.kernel == "paddle.to_tensor": + if layer.attrs["data"] in self.inputs: + invalid_list.append(layer_id) + for layer_id in invalid_list: + self.layers.pop(layer_id) + def gen_codes(code_list, indent=0): indent_blank = " " * indent codes = [] diff --git a/x2paddle/op_mapper/caffe2paddle/__pycache__/__init__.cpython-37.pyc b/x2paddle/op_mapper/caffe2paddle/__pycache__/__init__.cpython-37.pyc deleted file mode 100644 index 9b70e2ea71a7fa5c6502d5ae2fd79be148ce6ac6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 178 zcmZ?b<>g`k0;baC2_X70h=2h`Aj1KOi&=m~3PUi1CZpd=BK3Q6vrDG7#YIF5i0Ww;&T%V3Q~*olM~a@Qeg(f$7kkc amc+;F6;$5hu*uC&Da}c>16leRh#3Ia041m-JRLl znL&3iuo%s{6hUU3L>a}DtvGdBv zIFtC~kL{*LDJRX^n;GlLOUt9=D0Mioo5s0xCvz>S(wm08;bc|D$>}q5iEGKvCb_?x zQHkB`2rZ)RHfwpYVZ5=YA_ha=wF=%^lY!!vd&q3wY}v%7i&r*U zy~U>LY}-y_(6pLcEvIGKONKOH@#`$5#`~`uJdt$M&7HQrRB+R(=``JRw{1Iaq1(LL zvKr3SLCeiH2ZL5mxv6fe=Vs)=ZsoLXw=AdK?|sm+`j(rr9m_R(12<=1+HSRmttHb< z_b@&d>8W1z&NkXT)n0AcZmO+z+@z}KrMX7GtLnJ3!Jhc%daWzJkg(=)`;ChaZ1lHU z5A2*A2q`@9(n(Dd7h1OSJRZ`u8z)bkd@wjauGt?nw%C2^0r^6H19H#^E-nwQy3>t) zACAwqmr*2=*{o?~lZ9l#C?rcs!!VOZlE)RCO(#w4<7XJgbh47P4&#nheq8>W!Y_-T z(B&`T>|u%_j8KUeC$!oX}y~ zdIkGgP-NQr825T6uczJa?s1ztg|3iqXVW^ljm zU8Wbba6M_C3f=Pz+uM~^z;S7nmT#Bc%}Ec7x`$}{GU^qBKH_?BN1jm(`uH8xD0w~k zGWVsIMd@W0$7S!@x4198ECwy;Ugo5iUK{rBgzots+k-T~ox3?@q!YX5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kkr%QN{`W&NQS9;2fi2;~ zn;yQi@PlCW75r5>GCQocbu4#`RrC4xqe{Zoex~xjz?^1(q5&p>?{{0NPrJLPl ztkBo827QFTycJDCaT_>opCH4Bqx=)b+O2GRUH1l=e%~<{k4O3zLNTWQHU0v}cmWLt zKo=<_zP{$7S#f>s-x!QBUDv@F>%iRYn0i9HUe-2(Z33i=KS~B2ki(>t94LVkI^dIx z&Y%Sqgjc!3QW06CXaW~%#eQFurRB;^(*kUi-^Y70=EXG^`OY_HA~OBFew1)?bd1k% zjBj43iyCaAzs(N$Gv~R;-9ei4Ho~F1uZb^zq0rqi~qrb zNhQ`FvADq^LA{8-O$q_Y;s}f5EKaaE$>K2hxQw5@f`XyV zLdraDPMNc25x;ktY5X2EA2AP^r_6#mV;;e^d2_*h$b66al9@N}H;>_{i0jXq514N^ zOXebe^EgwJwjnJ(%I7Sia5I>gGPtT2G@thWAm%c?xy$&=eBJt?=sB!!gufTGrT;$C z@!*>G=YW=1Ip??9CcUt0p3-CcIDIU#3XT7F-{6N#neQ|o`@b!N Ba)tl^ diff --git a/x2paddle/op_mapper/caffe2paddle/caffe_op_mapper.py b/x2paddle/op_mapper/caffe2paddle/caffe_op_mapper.py index 582f90c..bf120b7 100644 --- a/x2paddle/op_mapper/caffe2paddle/caffe_op_mapper.py +++ b/x2paddle/op_mapper/caffe2paddle/caffe_op_mapper.py @@ -128,7 +128,6 @@ class CaffeOpMapper(): self.params = dict() self.paddle_graph = PaddleGraph(parent_layer=None, source_type="caffe") self.paddle_graph.outputs = self.graph.output_nodes - self.input_index = 0 self.inputs_info = {} self.nn_name2id = {} print("Total nodes: {}".format( @@ -193,11 +192,10 @@ class CaffeOpMapper(): "paddle.to_tensor", inputs={}, outputs=[node.layer_name], - data="x{}".format(self.input_index)) + data=node.name) shape = list(node.layer.input_param.shape[0].dim)[1:] - self.inputs_info["x{}".format(self.input_index)] = [[-1] + shape, + self.inputs_info[node.name] = [[-1] + shape, "float32"] - self.input_index += 1 def MemoryData(self, node): params = node.layer.memory_data_param @@ -206,7 +204,7 @@ class CaffeOpMapper(): "paddle.to_tensor", inputs={}, outputs=[node.layer_name], - data="x{}".format(self.input_index)) + data=node.layer_name) shape = list() shape.append(params.batch_size) shape.append(params.channels) @@ -216,8 +214,7 @@ class CaffeOpMapper(): else: shape.append(params.width) shape.append(params.height) - self.inputs_info["x{}".format(self.input_index)] = [shape, "float32"] - self.input_index += 1 + self.inputs_info[node.layer_name] = [shape, "float32"] def Convolution(self, node): conv2d_name = name_generator("conv", self.nn_name2id) diff --git a/x2paddle/op_mapper/onnx2paddle/opset9/opset.py b/x2paddle/op_mapper/onnx2paddle/opset9/opset.py index 28dab15..59cd56e 100755 --- a/x2paddle/op_mapper/onnx2paddle/opset9/opset.py +++ b/x2paddle/op_mapper/onnx2paddle/opset9/opset.py @@ -180,7 +180,6 @@ class OpSet9(): super(OpSet9, self).__init__() self.graph = decoder.graph self.paddle_graph = paddle_graph - self.input_index = 0 self.inputs_info = dict() self.weights = dict() self.nn_name2id = dict() @@ -245,9 +244,8 @@ class OpSet9(): kernel="paddle.to_tensor", inputs={}, outputs=[node.name], - data="x{}".format(self.input_index)) - self.inputs_info["x{}".format(self.input_index)] = [shape, node.dtype] - self.input_index += 1 + data=node.name) + self.inputs_info[node.name] = [shape, node.dtype] @print_mapping_info def create_parameter(self, node, parameter=None): diff --git a/x2paddle/op_mapper/tf2paddle/tf_op_mapper.py b/x2paddle/op_mapper/tf2paddle/tf_op_mapper.py index 819c5e5..b049e96 100644 --- a/x2paddle/op_mapper/tf2paddle/tf_op_mapper.py +++ b/x2paddle/op_mapper/tf2paddle/tf_op_mapper.py @@ -91,7 +91,6 @@ class TFOpMapper(): raise Exception("Model is not supported yet.") self.params = dict() self.nn_name2id = dict() - self.input_index = 0 self.inputs_info = dict() self.paddle_graph = PaddleGraph(parent_layer=None, source_type="tf") self.paddle_graph.outputs = self.graph.output_nodes @@ -213,9 +212,8 @@ class TFOpMapper(): kernel="paddle.to_tensor", inputs={}, outputs=[node.name], - data="x{}".format(self.input_index)) - self.inputs_info["x{}".format(self.input_index)] = [shape, node.dtype] - self.input_index += 1 + data=node.name) + self.inputs_info[node.name] = [shape, node.dtype] def Const(self, node): shape = node.out_shapes[0] -- GitLab