diff --git a/x2paddle/decoder/tf_decoder.py b/x2paddle/decoder/tf_decoder.py index c8380bdc6198f175aa244aa886007b0ab80b5cab..d5d862ad602e5f93f1f7923ca8dd5f28573d7049 100644 --- a/x2paddle/decoder/tf_decoder.py +++ b/x2paddle/decoder/tf_decoder.py @@ -361,6 +361,8 @@ class TFDecoder(object): continue graph_node = TFGraphNode(layer) dtype = graph_node.layer.attr['dtype'].type + if dtype == 10: + continue need_define_shape = 0 if self.define_input_shape: diff --git a/x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py b/x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py index ad03f06dd262acd4eaddee3b68854fb4363ea051..fe940663f07e0ba2ba0f22e53c2e3e711ef8757d 100644 --- a/x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py +++ b/x2paddle/op_mapper/dygraph/tf2paddle/tf_op_mapper.py @@ -676,8 +676,8 @@ class TFOpMapper(OpMapper): 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) + new_paddings = numpy.flip(paddings.value, 0).flatten().tolist() + dim = int(len(new_paddings) / 2) transpose_name = gen_name("pad", "transpose") self.paddle_graph.add_layer( kernel="paddle.transpose", @@ -688,7 +688,7 @@ class TFOpMapper(OpMapper): kernel="paddle.nn.Pad{}D".format(dim), inputs={"x": transpose_name}, outputs=layer_outputs, - pad=new_padding) + pad=new_paddings) self.paddle_graph.add_layer( kernel="paddle.transpose", inputs={"x": node.name}, diff --git a/x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py b/x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py index 700ac74a0d9bd512f0016ee64cfd1ff792ad4a5f..20317792370bee14ba56691c531b0dc0d656c5ea 100644 --- a/x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py +++ b/x2paddle/op_mapper/static/tf2paddle/tf_op_mapper.py @@ -661,7 +661,7 @@ class TFOpMapper(OpMapper): 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() + new_paddings = numpy.flip(paddings.value, 0).flatten().tolist() transpose_name = gen_name("pad", "transpose") self.paddle_graph.add_layer( kernel="paddle.transpose", @@ -672,7 +672,7 @@ class TFOpMapper(OpMapper): kernel="paddle.nn.functional.pad".format(dim), inputs={"x": transpose_name}, outputs=[node.name], - pad=new_padding) + pad=new_paddings) self.paddle_graph.add_layer( kernel="paddle.transpose", inputs={"x": node.name},