提交 b130ba73 编写于 作者: H Haonan 提交者: emailweixu

fixed bugs in conv_operator; add calc_output_size (#101)

上级 2c5a6ac0
......@@ -636,7 +636,6 @@ class Operator(Cfg):
input_layer_names,
):
self.add_keys(locals())
self.operator_conf = OperatorConfig()
self.operator_conf.type = self.type
......@@ -686,12 +685,15 @@ class ConvOperator(Operator):
if num_filters is not None:
self.operator_conf.num_filters = num_filters
parse_conv(conv_conf, input_layer_names[0], self.operator_conf.conv_conf, True)
parse_conv(conv_conf,
MakeLayerNameInSubmodel(input_layer_names[0]),
self.operator_conf.conv_conf)
self.operator_conf.output_size = (self.operator_conf.conv_conf.output_x ** 2) * num_filters
config_assert(len(input_layer_names) == 2, "Conv is binary operator")
def calc_output_size(self, input_sizes):
return self.operator_conf.output_size
# please refer to the comments in proto/ModelConfig.proto
......
......@@ -2668,7 +2668,7 @@ def classification_cost(input, label, name=None,
return LayerOutput(name, LayerType.COST, parents=[input, label])
def conv_operator(input, filter_size, num_filters,
num_channel=None, stride=1, padding=0,
num_channel=None, stride=1, padding=0, groups=1,
filter_size_y=None, stride_y=None, padding_y=None):
"""
Different from img_conv_layer, conv_op is an Operator, which can be used
......@@ -2715,7 +2715,7 @@ def conv_operator(input, filter_size, num_filters,
stride_y = stride
if padding_y is None:
padding_y = padding
op = ConvOperator(input_layer_name=[x.name for x in input],
op = ConvOperator(input_layer_names=[x.name for x in input],
num_filters = num_filter,
conv_conf=Conv(filter_size=filter_size,
padding=padding,
......@@ -2723,7 +2723,8 @@ def conv_operator(input, filter_size, num_filters,
channels=num_channel,
filter_size_y=filter_size_y,
padding_y=padding_y,
stride_y=stride_y))
stride_y=stride_y,
groups=groups))
op.origin = input
op.origin.operator = "conv_op"
return op
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册