fixed SpaceToBatchND bug
@@ -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,7 +416,7 @@ 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,
+ self.params[kernel_weight_name] = np.transpose(kernel_value,
(3, 2, 0, 1))
input_name = input.name
@@ -482,7 +482,7 @@ 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,
+ self.params[kernel_weight_name] = np.transpose(kernel_value,
(4, 3, 0, 1, 2))
input_name = input.name
@@ -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,7 +774,7 @@ class TFOpMapper():
pad_mode = node.get_attr("padding").decode()
kernel_weight_name = op_name + ".weight"
- self.params[kernel_weight_name] = numpy.transpose(kernel.value,
+ self.params[kernel_weight_name] = np.transpose(kernel.value,
(2, 3, 0, 1))
input_name = input.name
@@ -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]
