提交 1c56e0dc 编写于 作者: H Haonan 提交者: emailweixu

fixed the name issue for conv_operator and added a test case (#131)

上级 942d2b62
...@@ -2704,8 +2704,8 @@ def conv_operator(img, filter, filter_size, num_filters, ...@@ -2704,8 +2704,8 @@ def conv_operator(img, filter, filter_size, num_filters,
PaddlePaddle now supports rectangular filters, PaddlePaddle now supports rectangular filters,
the filter's shape can be (filter_size, filter_size_y). the filter's shape can be (filter_size, filter_size_y).
:type filter_size_y: int :type filter_size_y: int
:param num_filter: channel of output data. :param num_filters: channel of output data.
:type num_filter: int :type num_filters: int
:param num_channel: channel of input data. :param num_channel: channel of input data.
:type num_channel: int :type num_channel: int
:param stride: The x dimension of the stride. :param stride: The x dimension of the stride.
...@@ -2726,7 +2726,7 @@ def conv_operator(img, filter, filter_size, num_filters, ...@@ -2726,7 +2726,7 @@ def conv_operator(img, filter, filter_size, num_filters,
if padding_y is None: if padding_y is None:
padding_y = padding padding_y = padding
op = ConvOperator(input_layer_names=[img.name, filter.name], op = ConvOperator(input_layer_names=[img.name, filter.name],
num_filters = num_filter, num_filters = num_filters,
conv_conf=Conv(filter_size=filter_size, conv_conf=Conv(filter_size=filter_size,
padding=padding, padding=padding,
stride=stride, stride=stride,
......
...@@ -23,6 +23,15 @@ z = out_prod_layer(input1=x, input2=y) ...@@ -23,6 +23,15 @@ z = out_prod_layer(input1=x, input2=y)
x1 = fc_layer(input=x, size=5) x1 = fc_layer(input=x, size=5)
y1 = fc_layer(input=y, size=5) y1 = fc_layer(input=y, size=5)
z1 = mixed_layer(act=LinearActivation(),
input=[conv_operator(img=x1,
filter=y1,
filter_size=1,
num_filters=5,
num_channel=5,
stride=1)])
y2 = fc_layer(input=y, size=15) y2 = fc_layer(input=y, size=15)
cos1 = cos_sim(a=x1, b=y1) cos1 = cos_sim(a=x1, b=y1)
...@@ -30,7 +39,7 @@ cos3 = cos_sim(a=x1, b=y2, size=3) ...@@ -30,7 +39,7 @@ cos3 = cos_sim(a=x1, b=y2, size=3)
linear_comb = linear_comb_layer(weights=x1, vectors=y2, size=3) linear_comb = linear_comb_layer(weights=x1, vectors=y2, size=3)
out = fc_layer(input=[cos1, cos3, linear_comb, z], out = fc_layer(input=[cos1, cos3, linear_comb, z, z1],
size=num_classes, size=num_classes,
act=SoftmaxActivation()) act=SoftmaxActivation())
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册