提交 bfa2d61f 编写于 作者: W wjj19950828

deal with comments

上级 77c91898
......@@ -1622,18 +1622,27 @@ class TFOpMapper():
#zero-pad
constant_values = 0
pad_name = gen_name("space_to_batch", "pad")
paddings = [0, 0] + paddings + [0, 0]
paddings = [0, 0, 0, 0] + paddings
self.paddle_graph.add_layer(
kernel="paddle.nn.functional.pad",
kernel="paddle.transpose",
inputs={"x": input_name},
outputs=[input_name + "_transpose"],
perm=[0, 3, 1, 2])
self.paddle_graph.add_layer(
kernel="paddle.nn.functional.pad",
inputs={"x": input_name + "_transpose"},
outputs=[pad_name],
pad=paddings,
value=constant_values,
data_format=string('NHWC'))
value=constant_values)
self.paddle_graph.add_layer(
kernel="paddle.transpose",
inputs={"x": pad_name},
outputs=[pad_name + "_transpose"],
perm=[0, 2, 3, 1])
#reshape
n, h, w, c = x.out_shapes[0]
h = h + paddings[2] + paddings[3]
w = w + paddings[4] + paddings[5]
h = h + paddings[4] + paddings[5]
w = w + paddings[6] + paddings[7]
shape = [
n, h // block_shape[0], block_shape[0], w // block_shape[1],
block_shape[1], c
......@@ -1641,7 +1650,7 @@ class TFOpMapper():
reshape_name = gen_name("space_to_batch", "reshape")
self.paddle_graph.add_layer(
kernel="paddle.reshape",
inputs={"x": pad_name},
inputs={"x": pad_name + "_transpose"},
outputs=[reshape_name],
shape=shape)
#transpose
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册