Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix default value of cos_sim scale #1156

Merged
merged 1 commit into from
Jan 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/paddle/trainer/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2628,7 +2628,7 @@ def __init__(self,

@config_layer('cos')
class CosSimLayer(LayerBase):
def __init__(self, name, inputs, cos_scale=5, device=None):
def __init__(self, name, inputs, cos_scale=1, device=None):
super(CosSimLayer, self).__init__(
name, 'cos', 1, inputs=inputs, device=device)
config_assert(len(self.inputs) == 2, 'CosSimLayer must have 2 inputs')
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/trainer_config_helpers/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1673,7 +1673,7 @@ def trans_layer(input, name=None, layer_attr=None):

@wrap_name_default()
@layer_support()
def cos_sim(a, b, scale=5, size=1, name=None, layer_attr=None):
def cos_sim(a, b, scale=1, size=1, name=None, layer_attr=None):
"""
Cosine Similarity Layer. The cosine similarity equation is here.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ layers {
inputs {
input_layer_name: "b"
}
cos_scale: 5
cos_scale: 1
}
layers {
name: "__cos_sim_1__"
Expand All @@ -92,7 +92,7 @@ layers {
inputs {
input_layer_name: "c"
}
cos_scale: 5
cos_scale: 1
}
layers {
name: "__sum_to_one_norm_layer_0__"
Expand Down