Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
f1a9593d
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
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看板
未验证
提交
f1a9593d
编写于
6月 30, 2020
作者:
1
123malin
提交者:
GitHub
6月 30, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test=develop, bug fix for index_select and roll op (#25251)
上级
5209b9a5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
4 deletion
+19
-4
paddle/fluid/operators/index_select_op.h
paddle/fluid/operators/index_select_op.h
+17
-0
python/paddle/fluid/tests/unittests/CMakeLists.txt
python/paddle/fluid/tests/unittests/CMakeLists.txt
+0
-2
python/paddle/fluid/tests/unittests/test_roll_op.py
python/paddle/fluid/tests/unittests/test_roll_op.py
+2
-2
未找到文件。
paddle/fluid/operators/index_select_op.h
浏览文件 @
f1a9593d
...
...
@@ -52,6 +52,23 @@ void IndexSelectInner(const framework::ExecutionContext& context,
TensorToVector
(
index
,
context
.
device_context
(),
&
index_vec
);
std
::
vector
<
T
>
out_vec
(
output
->
numel
());
for
(
int
i
=
0
;
i
<
index_size
;
i
++
)
{
PADDLE_ENFORCE_GE
(
index_vec
[
i
],
0
,
platform
::
errors
::
InvalidArgument
(
"Variable value (index) of OP(index_select) "
"expected >= 0 and < %ld, but got %ld. Please check input "
"value."
,
input_dim
[
dim
],
index_vec
[
i
]));
PADDLE_ENFORCE_LT
(
index_vec
[
i
],
input_dim
[
dim
],
platform
::
errors
::
InvalidArgument
(
"Variable value (index) of OP(index_select) "
"expected >= 0 and < %ld, but got %ld. Please check input "
"value."
,
input_dim
[
dim
],
index_vec
[
i
]));
}
VLOG
(
3
)
<<
"Index_Select_Debug; outer_nums: "
<<
outer_nums
<<
"; slice_size: "
<<
slice_size
<<
"; input_width: "
<<
input_width
<<
"; output_width: "
<<
output_width
...
...
python/paddle/fluid/tests/unittests/CMakeLists.txt
浏览文件 @
f1a9593d
...
...
@@ -45,8 +45,6 @@ if(NOT WITH_GPU OR WIN32)
LIST
(
REMOVE_ITEM TEST_OPS test_reducescatter_api
)
endif
()
#TODO(malin): Fix this unitest failed on GCC8.
LIST
(
REMOVE_ITEM TEST_OPS test_roll_op
)
#TODO(sunxiaolong01): Fix this unitest failed on GCC8.
LIST
(
REMOVE_ITEM TEST_OPS test_conv2d_transpose_op
)
if
(
WIN32
)
...
...
python/paddle/fluid/tests/unittests/test_roll_op.py
浏览文件 @
f1a9593d
...
...
@@ -50,7 +50,7 @@ class TestRollOp(OpTest):
class
TestRollOpCase2
(
TestRollOp
):
def
init_dtype_type
(
self
):
self
.
dtype
=
np
.
float32
self
.
x_shape
=
(
100
,
10
0
,
5
)
self
.
x_shape
=
(
100
,
10
,
5
)
self
.
shifts
=
[
8
,
-
1
]
self
.
dims
=
[
-
1
,
-
2
]
...
...
@@ -60,7 +60,7 @@ class TestRollAPI(unittest.TestCase):
self
.
data_x
=
np
.
array
(
[[
1.0
,
2.0
,
3.0
],
[
4.0
,
5.0
,
6.0
],
[
7.0
,
8.0
,
9.0
]])
def
test_
index_select
_api
(
self
):
def
test_
roll_op
_api
(
self
):
self
.
input_data
()
# case 1:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录