提交 48765570 编写于 作者: S SunAhong1993

rollback

上级 657cd06d
...@@ -877,12 +877,12 @@ class TFOpMapper(OpMapper): ...@@ -877,12 +877,12 @@ class TFOpMapper(OpMapper):
num_or_sections=num_split, num_or_sections=num_split,
dim=dim) dim=dim)
def Slice(self, node): def Slice(self, node):
input = self.graph.get_node(node.layer.input[0]) input = self.graph.get_node(node.layer.input[0])
begin = self.graph.get_node(node.layer.input[1]) begin = self.graph.get_node(node.layer.input[1])
size = self.graph.get_node(node.layer.input[2]) size = self.graph.get_node(node.layer.input[2])
inputs = {"input": input.name} inputs = {"x": input.name}
attrs = {} attrs = {}
if begin.layer_type == "Const": if begin.layer_type == "Const":
begin = begin.value.tolist() begin = begin.value.tolist()
...@@ -890,7 +890,7 @@ class TFOpMapper(OpMapper): ...@@ -890,7 +890,7 @@ class TFOpMapper(OpMapper):
else: else:
# shape = begin.out_shapes[0] # shape = begin.out_shapes[0]
# reshape_name = gen_name("slice", "reshape") # reshape_name = gen_name("slice", "reshape")
# program.add_layer( # self.paddle_graph.add_layer(
# kernel="fluid.layers.reshape", # kernel="fluid.layers.reshape",
# inputs={"x": begin.name}, # inputs={"x": begin.name},
# outputs=[reshape_name], # outputs=[reshape_name],
...@@ -901,32 +901,20 @@ class TFOpMapper(OpMapper): ...@@ -901,32 +901,20 @@ class TFOpMapper(OpMapper):
if size.layer_type == "Const": if size.layer_type == "Const":
size = size.value.tolist() size = size.value.tolist()
attrs['shape'] = size attrs['shape'] = size
shape = size
else: else:
shape = size.out_shapes[0] shape = size.out_shapes[0]
# reshape_name = gen_name("slice", "reshape") reshape_name = gen_name("slice", "reshape")
# program.add_layer( self.paddle_graph.add_layer(
# kernel="fluid.layers.reshape", kernel="fluid.layers.reshape",
# inputs={"x": size.name}, inputs={"x": size.name},
# outputs=[reshape_name], outputs=[reshape_name],
# shape=shape) shape=shape)
# inputs['shape'] = reshape_name inputs['shape'] = reshape_name
self.paddle_graph.add_layer(
for i, s in enumerate(shape): kernel="fluid.layers.crop_tensor",
if s < 0:
shape[i] = 32767
program.add_layer(
kernel="fluid.layers.slice",
inputs=inputs, inputs=inputs,
outputs=[node.name], outputs=[node.name],
axes=list(range(len(attrs['offsets']))), **attrs)
starts=attrs['offsets'],
ends=[attrs['offsets'][i] + shape[i] for i in range(len(shape))])
# program.add_layer(
# kernel="fluid.layers.crop_tensor",
# inputs=inputs,
# outputs=[node.name],
# **attrs)
def ResizeNearestNeighbor(self, node): def ResizeNearestNeighbor(self, node):
input = self.graph.get_node(node.layer.input[0]) input = self.graph.get_node(node.layer.input[0])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册