Skip to content

Commit

Permalink
fixed the name issue for conv_operator and added a test case (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
Haonan authored and emailweixu committed Sep 28, 2016
1 parent 942d2b6 commit 1c56e0d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 3 additions & 3 deletions python/paddle/trainer_config_helpers/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2704,8 +2704,8 @@ def conv_operator(img, filter, filter_size, num_filters,
PaddlePaddle now supports rectangular filters,
the filter's shape can be (filter_size, filter_size_y).
:type filter_size_y: int
:param num_filter: channel of output data.
:type num_filter: int
:param num_filters: channel of output data.
:type num_filters: int
:param num_channel: channel of input data.
:type num_channel: int
:param stride: The x dimension of the stride.
Expand All @@ -2726,7 +2726,7 @@ def conv_operator(img, filter, filter_size, num_filters,
if padding_y is None:
padding_y = padding
op = ConvOperator(input_layer_names=[img.name, filter.name],
num_filters = num_filter,
num_filters = num_filters,
conv_conf=Conv(filter_size=filter_size,
padding=padding,
stride=stride,
Expand Down
11 changes: 10 additions & 1 deletion python/paddle/trainer_config_helpers/tests/layers_test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,23 @@

x1 = fc_layer(input=x, 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)

cos1 = cos_sim(a=x1, b=y1)
cos3 = cos_sim(a=x1, b=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,
act=SoftmaxActivation())

Expand Down

0 comments on commit 1c56e0d

Please sign in to comment.