提交 d4629a1a 编写于 作者: R Renwb1991

caffe2fluid: repair scale with rename variable

上级 0afc4b02
...@@ -528,14 +528,14 @@ class Network(object): ...@@ -528,14 +528,14 @@ class Network(object):
if isinstance(input, list) and len(input) == 2: if isinstance(input, list) and len(input) == 2:
# for two tensor, here resets axis to 1. Maybe there is a bug for unkown case. # for two tensor, here resets axis to 1. Maybe there is a bug for unkown case.
axis = 1 axis = 1
output_shape = input[0].shape[axis:axis + num_axes] bias_shape = input[0].shape[axis:axis + num_axes]
scale_param = input[1] scale_param = input[1]
input = input[0] input = input[0]
else: else:
output_shape = input.shape[axis:axis + num_axes] bias_shape = input.shape[axis:axis + num_axes]
param_attr = fluid.ParamAttr(name=prefix + 'scale') param_attr = fluid.ParamAttr(name=prefix + 'scale')
scale_param = fluid.layers.create_parameter( scale_param = fluid.layers.create_parameter(
shape=output_shape, shape=bias_shape,
dtype=input.dtype, dtype=input.dtype,
name=name, name=name,
attr=param_attr, attr=param_attr,
...@@ -548,7 +548,7 @@ class Network(object): ...@@ -548,7 +548,7 @@ class Network(object):
axis=axis, axis=axis,
name=self.get_unique_output_name(name, 'scale_mul')) name=self.get_unique_output_name(name, 'scale_mul'))
scale_shape = output_shape scale_shape = bias_shape
offset_attr = fluid.ParamAttr(name=prefix + 'offset') offset_attr = fluid.ParamAttr(name=prefix + 'offset')
offset_param = fluid.layers.create_parameter( offset_param = fluid.layers.create_parameter(
shape=scale_shape, shape=scale_shape,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册