提交 7cc0eeea 编写于 作者: S SunAhong1993

fix the lrn

上级 1d95a8a8
...@@ -366,7 +366,7 @@ class CaffeOpMapper(OpMapper): ...@@ -366,7 +366,7 @@ class CaffeOpMapper(OpMapper):
input = self.graph.get_bottom_node(node, idx=0, copy=True) input = self.graph.get_bottom_node(node, idx=0, copy=True)
attr = { attr = {
'n': params.local_size, 'n': params.local_size,
'k': 1.0, 'k': params.k,
'alpha': alpha, 'alpha': alpha,
'beta': params.beta, 'beta': params.beta,
'name': string(node.layer_name) 'name': string(node.layer_name)
...@@ -652,7 +652,7 @@ class CaffeOpMapper(OpMapper): ...@@ -652,7 +652,7 @@ class CaffeOpMapper(OpMapper):
]).astype('float32') ]).astype('float32')
scale = 0 scale = 0
else: else:
node.data = [np.squeeze(i) for i in node.data] node.data = [np.squeeze(i).astype('float32') for i in node.data]
mean, variance, scale = node.data mean, variance, scale = node.data
# Prescale the stats # Prescale the stats
scaling_factor = 1.0 / scale if scale != 0 else 0 scaling_factor = 1.0 / scale if scale != 0 else 0
...@@ -687,8 +687,8 @@ class CaffeOpMapper(OpMapper): ...@@ -687,8 +687,8 @@ class CaffeOpMapper(OpMapper):
input_c, input_c,
]).astype('float32') ]).astype('float32')
else: else:
self.weights[node.layer_name + '_scale'] = np.squeeze(node.data[0]) self.weights[node.layer_name + '_scale'] = np.squeeze(node.data[0]).astype('float32')
self.weights[node.layer_name + '_offset'] = np.squeeze(node.data[1]) self.weights[node.layer_name + '_offset'] = np.squeeze(node.data[1]).astype('float32')
params = node.layer.scale_param params = node.layer.scale_param
axis = params.axis axis = params.axis
num_axes = params.num_axes num_axes = params.num_axes
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册