Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
929efdc5
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
929efdc5
编写于
11月 17, 2017
作者:
C
caoying03
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
follow comments.
上级
4772b78c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
4 addition
and
4 deletion
+4
-4
python/paddle/trainer/config_parser.py
python/paddle/trainer/config_parser.py
+1
-1
python/paddle/trainer_config_helpers/layers.py
python/paddle/trainer_config_helpers/layers.py
+2
-2
python/paddle/trainer_config_helpers/tests/configs/protostr/test_l2_distance_layer.protostr
...rs/tests/configs/protostr/test_l2_distance_layer.protostr
+1
-1
未找到文件。
python/paddle/trainer/config_parser.py
浏览文件 @
929efdc5
...
@@ -3338,7 +3338,7 @@ class CosSimLayer(LayerBase):
...
@@ -3338,7 +3338,7 @@ class CosSimLayer(LayerBase):
config_assert
(
len
(
self
.
inputs
)
==
2
,
'CosSimLayer must have 2 inputs'
)
config_assert
(
len
(
self
.
inputs
)
==
2
,
'CosSimLayer must have 2 inputs'
)
config_assert
(
config_assert
(
self
.
get_input_layer
(
0
).
size
==
self
.
get_input_layer
(
1
).
size
,
self
.
get_input_layer
(
0
).
size
==
self
.
get_input_layer
(
1
).
size
,
'
inputs of CosSimLayer must have same dim
'
)
'
The two inputs of CosSimLayer must have the same dimensionality.
'
)
self
.
config
.
cos_scale
=
cos_scale
self
.
config
.
cos_scale
=
cos_scale
...
...
python/paddle/trainer_config_helpers/layers.py
浏览文件 @
929efdc5
...
@@ -2338,7 +2338,7 @@ def cos_sim(a, b, scale=1, size=1, name=None, layer_attr=None):
...
@@ -2338,7 +2338,7 @@ def cos_sim(a, b, scale=1, size=1, name=None, layer_attr=None):
@
layer_support
()
@
layer_support
()
def
l2_distance_layer
(
x
,
y
,
name
=
None
,
layer_attr
=
None
):
def
l2_distance_layer
(
x
,
y
,
name
=
None
,
layer_attr
=
None
):
"""
"""
This layer calculate
and return
the Euclidean distance between two input
This layer calculate
s and returns
the Euclidean distance between two input
vectors a and b. The equation is as follows:
vectors a and b. The equation is as follows:
.. math::
.. math::
...
@@ -2374,7 +2374,7 @@ def l2_distance_layer(x, y, name=None, layer_attr=None):
...
@@ -2374,7 +2374,7 @@ def l2_distance_layer(x, y, name=None, layer_attr=None):
Layer
(
Layer
(
name
=
name
,
name
=
name
,
type
=
LayerType
.
L2_DISTANCE
,
type
=
LayerType
.
L2_DISTANCE
,
inputs
=
[
x
.
name
,
x
.
name
],
inputs
=
[
x
.
name
,
y
.
name
],
**
ExtraLayerAttribute
.
to_kwargs
(
layer_attr
))
**
ExtraLayerAttribute
.
to_kwargs
(
layer_attr
))
return
LayerOutput
(
name
,
LayerType
.
L2_DISTANCE
,
parents
=
[
x
,
y
],
size
=
1
)
return
LayerOutput
(
name
,
LayerType
.
L2_DISTANCE
,
parents
=
[
x
,
y
],
size
=
1
)
...
...
python/paddle/trainer_config_helpers/tests/configs/protostr/test_l2_distance_layer.protostr
浏览文件 @
929efdc5
...
@@ -20,7 +20,7 @@ layers {
...
@@ -20,7 +20,7 @@ layers {
input_layer_name: "x"
input_layer_name: "x"
}
}
inputs {
inputs {
input_layer_name: "
x
"
input_layer_name: "
y
"
}
}
}
}
input_layer_names: "x"
input_layer_names: "x"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录