未验证 提交 f671ccfa 编写于 作者: J Jason 提交者: GitHub

Merge pull request #478 from SunAhong1993/tf

fix the tf
...@@ -361,6 +361,8 @@ class TFDecoder(object): ...@@ -361,6 +361,8 @@ class TFDecoder(object):
continue continue
graph_node = TFGraphNode(layer) graph_node = TFGraphNode(layer)
dtype = graph_node.layer.attr['dtype'].type dtype = graph_node.layer.attr['dtype'].type
if dtype == 10:
continue
need_define_shape = 0 need_define_shape = 0
if self.define_input_shape: if self.define_input_shape:
......
...@@ -676,8 +676,8 @@ class TFOpMapper(OpMapper): ...@@ -676,8 +676,8 @@ class TFOpMapper(OpMapper):
input = self.graph.get_input_node(node, 0) input = self.graph.get_input_node(node, 0)
paddings = self.graph.get_input_node(node, 1) paddings = self.graph.get_input_node(node, 1)
assert paddings.layer_type == "Const", "Padding should be Const" 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()
dim = int(len(paddings) / 2) dim = int(len(new_paddings) / 2)
transpose_name = gen_name("pad", "transpose") transpose_name = gen_name("pad", "transpose")
self.paddle_graph.add_layer( self.paddle_graph.add_layer(
kernel="paddle.transpose", kernel="paddle.transpose",
...@@ -688,7 +688,7 @@ class TFOpMapper(OpMapper): ...@@ -688,7 +688,7 @@ class TFOpMapper(OpMapper):
kernel="paddle.nn.Pad{}D".format(dim), kernel="paddle.nn.Pad{}D".format(dim),
inputs={"x": transpose_name}, inputs={"x": transpose_name},
outputs=layer_outputs, outputs=layer_outputs,
pad=new_padding) pad=new_paddings)
self.paddle_graph.add_layer( self.paddle_graph.add_layer(
kernel="paddle.transpose", kernel="paddle.transpose",
inputs={"x": node.name}, inputs={"x": node.name},
......
...@@ -661,7 +661,7 @@ class TFOpMapper(OpMapper): ...@@ -661,7 +661,7 @@ class TFOpMapper(OpMapper):
input = self.graph.get_input_node(node, 0) input = self.graph.get_input_node(node, 0)
paddings = self.graph.get_input_node(node, 1) paddings = self.graph.get_input_node(node, 1)
assert paddings.layer_type == "Const", "Padding should be Const" 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") transpose_name = gen_name("pad", "transpose")
self.paddle_graph.add_layer( self.paddle_graph.add_layer(
kernel="paddle.transpose", kernel="paddle.transpose",
...@@ -672,7 +672,7 @@ class TFOpMapper(OpMapper): ...@@ -672,7 +672,7 @@ class TFOpMapper(OpMapper):
kernel="paddle.nn.functional.pad".format(dim), kernel="paddle.nn.functional.pad".format(dim),
inputs={"x": transpose_name}, inputs={"x": transpose_name},
outputs=[node.name], outputs=[node.name],
pad=new_padding) pad=new_paddings)
self.paddle_graph.add_layer( self.paddle_graph.add_layer(
kernel="paddle.transpose", kernel="paddle.transpose",
inputs={"x": node.name}, inputs={"x": node.name},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册