Skip to content

Commit 1c56e0d

Browse files
Haonanemailweixu
authored andcommitted
fixed the name issue for conv_operator and added a test case (#131)
1 parent 942d2b6 commit 1c56e0d

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

python/paddle/trainer_config_helpers/layers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2704,8 +2704,8 @@ def conv_operator(img, filter, filter_size, num_filters,
27042704
PaddlePaddle now supports rectangular filters,
27052705
the filter's shape can be (filter_size, filter_size_y).
27062706
:type filter_size_y: int
2707-
:param num_filter: channel of output data.
2708-
:type num_filter: int
2707+
:param num_filters: channel of output data.
2708+
:type num_filters: int
27092709
:param num_channel: channel of input data.
27102710
:type num_channel: int
27112711
:param stride: The x dimension of the stride.
@@ -2726,7 +2726,7 @@ def conv_operator(img, filter, filter_size, num_filters,
27262726
if padding_y is None:
27272727
padding_y = padding
27282728
op = ConvOperator(input_layer_names=[img.name, filter.name],
2729-
num_filters = num_filter,
2729+
num_filters = num_filters,
27302730
conv_conf=Conv(filter_size=filter_size,
27312731
padding=padding,
27322732
stride=stride,

python/paddle/trainer_config_helpers/tests/layers_test_config.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,23 @@
2323

2424
x1 = fc_layer(input=x, size=5)
2525
y1 = fc_layer(input=y, size=5)
26+
27+
z1 = mixed_layer(act=LinearActivation(),
28+
input=[conv_operator(img=x1,
29+
filter=y1,
30+
filter_size=1,
31+
num_filters=5,
32+
num_channel=5,
33+
stride=1)])
34+
2635
y2 = fc_layer(input=y, size=15)
2736

2837
cos1 = cos_sim(a=x1, b=y1)
2938
cos3 = cos_sim(a=x1, b=y2, size=3)
3039

3140
linear_comb = linear_comb_layer(weights=x1, vectors=y2, size=3)
3241

33-
out = fc_layer(input=[cos1, cos3, linear_comb, z],
42+
out = fc_layer(input=[cos1, cos3, linear_comb, z, z1],
3443
size=num_classes,
3544
act=SoftmaxActivation())
3645

0 commit comments

Comments
 (0)