提交 19cb2a7f 编写于 作者: Z zhangruiqing01

fix default value of cos_sim scale

上级 b0003860
...@@ -2628,7 +2628,7 @@ class AverageLayer(LayerBase): ...@@ -2628,7 +2628,7 @@ class AverageLayer(LayerBase):
@config_layer('cos') @config_layer('cos')
class CosSimLayer(LayerBase): 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__( super(CosSimLayer, self).__init__(
name, 'cos', 1, inputs=inputs, device=device) name, 'cos', 1, inputs=inputs, device=device)
config_assert(len(self.inputs) == 2, 'CosSimLayer must have 2 inputs') config_assert(len(self.inputs) == 2, 'CosSimLayer must have 2 inputs')
......
...@@ -1673,7 +1673,7 @@ def trans_layer(input, name=None, layer_attr=None): ...@@ -1673,7 +1673,7 @@ def trans_layer(input, name=None, layer_attr=None):
@wrap_name_default() @wrap_name_default()
@layer_support() @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. Cosine Similarity Layer. The cosine similarity equation is here.
......
...@@ -79,7 +79,7 @@ layers { ...@@ -79,7 +79,7 @@ layers {
inputs { inputs {
input_layer_name: "b" input_layer_name: "b"
} }
cos_scale: 5 cos_scale: 1
} }
layers { layers {
name: "__cos_sim_1__" name: "__cos_sim_1__"
...@@ -92,7 +92,7 @@ layers { ...@@ -92,7 +92,7 @@ layers {
inputs { inputs {
input_layer_name: "c" input_layer_name: "c"
} }
cos_scale: 5 cos_scale: 1
} }
layers { layers {
name: "__sum_to_one_norm_layer_0__" name: "__sum_to_one_norm_layer_0__"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册