提交 eef8a222 编写于 作者: S sonixixi

fix caffe crop opmap

上级 6927786f
......@@ -797,21 +797,21 @@ class CaffeOpMapper(OpMapper):
input = self.graph.get_bottom_node(node, idx=0, copy=True)
example = self.graph.get_bottom_node(node, idx=1, copy=True)
params = node.layer.crop_param
axis = parmas.axis
axis = params.axis
input_shape = node.input_shape[0]
if axis < 0:
axis += len(input_shape)
offset_real = [0] * len(input_shape)
if hasattr(params, offset):
if hasattr(params, "offset") and len(params.offset) > 0:
offset = list(params.offset)
assert (len(input_shape) - axis) == len(
offset), "invalid offset[%s] in crop layer" % (str(offset))
offset_real = [0] * axis + offset
attr = {'offsets': offset_real, 'name': string(node.layer_name)}
attr = {'offsets': list(offset_real), 'name': string(node.layer_name)}
node.fluid_code.add_layer("crop",
inputs={
'x': input,
'y': example
'shape': node.input_shape[1]
},
output=node,
param_attr=attr)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册