Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
f5c08c3f
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2297
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f5c08c3f
编写于
4月 26, 2020
作者:
Z
Zhang Ting
提交者:
GitHub
4月 26, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
set int64 for Output(Length) of sequence_pad, test=develop (#24161)
上级
9a93f6aa
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
1 deletion
+10
-1
python/paddle/fluid/layers/sequence_lod.py
python/paddle/fluid/layers/sequence_lod.py
+2
-1
python/paddle/fluid/tests/unittests/sequence/test_sequence_pad_op.py
...le/fluid/tests/unittests/sequence/test_sequence_pad_op.py
+8
-0
未找到文件。
python/paddle/fluid/layers/sequence_lod.py
浏览文件 @
f5c08c3f
...
...
@@ -18,6 +18,7 @@ from .layer_function_generator import templatedoc
from
..framework
import
Variable
,
in_dygraph_mode
from
..layer_helper
import
LayerHelper
from
..data_feeder
import
check_variable_and_dtype
,
check_type
,
check_dtype
from
..core
import
VarDesc
__all__
=
[
'sequence_conv'
,
...
...
@@ -941,7 +942,7 @@ def sequence_pad(x, pad_value, maxlen=None, name=None):
'fluid.layers.sequence_pad'
)
dtype
=
helper
.
input_dtype
()
out
=
helper
.
create_variable_for_type_inference
(
dtype
)
length
=
helper
.
create_variable_for_type_inference
(
dtype
)
length
=
helper
.
create_variable_for_type_inference
(
VarDesc
.
VarType
.
INT64
)
pad_value
.
stop_gradient
=
True
length
.
stop_gradient
=
True
...
...
python/paddle/fluid/tests/unittests/sequence/test_sequence_pad_op.py
浏览文件 @
f5c08c3f
...
...
@@ -19,6 +19,7 @@ sys.path.append("../")
from
op_test
import
OpTest
import
paddle.fluid
as
fluid
import
paddle.fluid.core
as
core
class
TestSequencePadOp
(
OpTest
):
...
...
@@ -173,6 +174,13 @@ class TestSequencePadOpError(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
test_dtype
)
def
test_length_dtype
(
self
):
x
=
fluid
.
data
(
name
=
'x'
,
shape
=
[
10
,
5
],
dtype
=
'float32'
,
lod_level
=
1
)
pad_value
=
fluid
.
layers
.
assign
(
input
=
np
.
array
([
0.0
],
dtype
=
np
.
float32
))
out
,
length
=
fluid
.
layers
.
sequence_pad
(
x
=
x
,
pad_value
=
pad_value
)
# check if the dtype of length is int64 in compile time
self
.
assertEqual
(
length
.
dtype
,
core
.
VarDesc
.
VarType
.
INT64
)
if
__name__
==
'__main__'
:
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录