Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
3242e286
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3242e286
编写于
12月 18, 2017
作者:
Y
yangyaming
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
seq_expand --> sequence_expand
上级
0d748f5b
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
11 addition
and
11 deletion
+11
-11
doc/api/v2/fluid/layers.rst
doc/api/v2/fluid/layers.rst
+2
-2
python/paddle/v2/fluid/layers/nn.py
python/paddle/v2/fluid/layers/nn.py
+8
-8
python/paddle/v2/fluid/tests/test_layers.py
python/paddle/v2/fluid/tests/test_layers.py
+1
-1
未找到文件。
doc/api/v2/fluid/layers.rst
浏览文件 @
3242e286
...
...
@@ -300,7 +300,7 @@ conv2d_transpose
.. autofunction:: paddle.v2.fluid.layers.conv2d_transpose
:noindex:
seq_expand
seq
uence
_expand
---------
.. autofunction:: paddle.v2.fluid.layers.seq_expand
.. autofunction:: paddle.v2.fluid.layers.seq
uence
_expand
:noindex:
python/paddle/v2/fluid/layers/nn.py
浏览文件 @
3242e286
...
...
@@ -10,7 +10,7 @@ __all__ = [
'fc'
,
'embedding'
,
'dynamic_lstm'
,
'gru_unit'
,
'linear_chain_crf'
,
'crf_decoding'
,
'cos_sim'
,
'cross_entropy'
,
'square_error_cost'
,
'accuracy'
,
'chunk_eval'
,
'sequence_conv'
,
'conv2d'
,
'sequence_pool'
,
'pool2d'
,
'batch_norm'
,
'beam_search_decode'
,
'conv2d_transpose'
,
'seq_expand'
'batch_norm'
,
'beam_search_decode'
,
'conv2d_transpose'
,
'seq
uence
_expand'
]
...
...
@@ -791,10 +791,10 @@ def conv2d_transpose(input,
return
out
def
seq_expand
(
x
,
y
,
main_program
=
None
,
startup_program
=
None
):
def
seq
uence
_expand
(
x
,
y
,
main_program
=
None
,
startup_program
=
None
):
"""Sequence Expand Layer. This layer will expand the input variable **x**
according to LoD information of **y**. And the following examples will
explain how seq_expand works:
explain how seq
uence
_expand works:
.. code-block:: text
...
...
@@ -823,7 +823,7 @@ def seq_expand(x, y, main_program=None, startup_program=None):
x.dims = [3, 1]
y is a LoDTensor:
Y
.lod = [[0, 2, 3, 6]]
y
.lod = [[0, 2, 3, 6]]
with condition len(y.lod[-1]) - 1 == x.dims[0]
...
...
@@ -847,12 +847,12 @@ def seq_expand(x, y, main_program=None, startup_program=None):
x = fluid.layers.data(name='x', shape=[10], dtype='float32')
y = fluid.layers.data(name='y', shape=[10, 20],
dtype='float32', lod_level=1)
out = layers.seq_expand(x=x, y=y)
out = layers.seq
uence
_expand(x=x, y=y)
"""
helper
=
LayerHelper
(
'seq_expand'
,
input
=
x
,
**
locals
())
helper
=
LayerHelper
(
'seq
uence
_expand'
,
input
=
x
,
**
locals
())
dtype
=
helper
.
input_dtype
()
tmp
=
helper
.
create_tmp_variable
(
dtype
)
helper
.
append_op
(
type
=
'seq_expand'
,
inputs
=
{
'X'
:
x
,
type
=
'seq
uence
_expand'
,
inputs
=
{
'X'
:
x
,
'Y'
:
y
},
outputs
=
{
'Out'
:
tmp
})
return
tmp
python/paddle/v2/fluid/tests/test_layers.py
浏览文件 @
3242e286
...
...
@@ -167,7 +167,7 @@ class TestBook(unittest.TestCase):
x
=
layers
.
data
(
name
=
'x'
,
shape
=
[
10
],
dtype
=
'float32'
)
y
=
layers
.
data
(
name
=
'y'
,
shape
=
[
10
,
20
],
dtype
=
'float32'
,
lod_level
=
1
)
self
.
assertIsNotNone
(
layers
.
seq_expand
(
x
=
x
,
y
=
y
))
self
.
assertIsNotNone
(
layers
.
seq
uence
_expand
(
x
=
x
,
y
=
y
))
print
(
str
(
program
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录