提交 cf75526c 编写于 作者: W wjj19950828

fixed SpaceToBatchND bug

上级 1690cfd1
......@@ -18,7 +18,7 @@ from x2paddle.core.util import *
import traceback
import math
import inspect
import numpy
import numpy as np
import sys
name_counter = dict()
......@@ -416,8 +416,8 @@ class TFOpMapper():
kernel_value = self.decoder.infer_tensor(
kernel, use_diff_inputs=False)
kernel_weight_name = op_name + ".weight"
self.params[kernel_weight_name] = numpy.transpose(kernel_value,
(3, 2, 0, 1))
self.params[kernel_weight_name] = np.transpose(kernel_value,
(3, 2, 0, 1))
input_name = input.name
if data_format == "NHWC":
......@@ -482,8 +482,8 @@ class TFOpMapper():
kernel_value = self.decoder.infer_tensor(
kernel, use_diff_inputs=False)
kernel_weight_name = op_name + ".weight"
self.params[kernel_weight_name] = numpy.transpose(kernel_value,
(4, 3, 0, 1, 2))
self.params[kernel_weight_name] = np.transpose(kernel_value,
(4, 3, 0, 1, 2))
input_name = input.name
if data_format == "NDHWC":
......@@ -630,7 +630,7 @@ class TFOpMapper():
"shape": param.name},
outputs=[node.name])
if param.layer_type != "Const":
out_shape = numpy.array(node.out_shapes[0])
out_shape = np.array(node.out_shapes[0])
if (out_shape > 0).any():
out_shape[out_shape < 0] = 0
self.paddle_graph.add_layer(
......@@ -774,8 +774,8 @@ class TFOpMapper():
pad_mode = node.get_attr("padding").decode()
kernel_weight_name = op_name + ".weight"
self.params[kernel_weight_name] = numpy.transpose(kernel.value,
(2, 3, 0, 1))
self.params[kernel_weight_name] = np.transpose(kernel.value,
(2, 3, 0, 1))
input_name = input.name
if data_format == "NHWC":
......@@ -1304,7 +1304,7 @@ class TFOpMapper():
data_format = node.get_attr("data_format").decode()
kernel_name = op_name + ".weight"
self.params[kernel_name] = numpy.transpose(kernel.value, (3, 2, 0, 1))
self.params[kernel_name] = np.transpose(kernel.value, (3, 2, 0, 1))
input_name = input.name
if data_format == "NHWC":
......@@ -1591,7 +1591,7 @@ class TFOpMapper():
kernel="paddle.reshape",
inputs={"x": transpose_name},
outputs=[reshape_name],
shape=shape)
shape=list(shape))
#crop
attrs = {}
crop_shape = shape
......@@ -1628,7 +1628,8 @@ class TFOpMapper():
inputs={"x": input_name},
outputs=[pad_name],
pad=paddings,
value=constant_values)
value=constant_values,
data_format=string('NHWC'))
#reshape
n, h, w, c = x.out_shapes[0]
h = h + paddings[2] + paddings[3]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册