Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
757b5d31
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
757b5d31
编写于
5月 13, 2022
作者:
R
Ruibiao Chen
提交者:
GitHub
5月 13, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor test_tensordot (#42650)
* Refactor test_tensordot * Add test_static * Fix CI errors
上级
cc0fa79b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
132 addition
and
94 deletion
+132
-94
python/paddle/fluid/tests/unittests/CMakeLists.txt
python/paddle/fluid/tests/unittests/CMakeLists.txt
+1
-3
python/paddle/fluid/tests/unittests/test_tensordot.py
python/paddle/fluid/tests/unittests/test_tensordot.py
+131
-91
未找到文件。
python/paddle/fluid/tests/unittests/CMakeLists.txt
浏览文件 @
757b5d31
...
@@ -1036,6 +1036,7 @@ set_tests_properties(test_imperative_selected_rows_to_lod_tensor PROPERTIES TIME
...
@@ -1036,6 +1036,7 @@ set_tests_properties(test_imperative_selected_rows_to_lod_tensor PROPERTIES TIME
set_tests_properties
(
test_index_select_op PROPERTIES TIMEOUT 120
)
set_tests_properties
(
test_index_select_op PROPERTIES TIMEOUT 120
)
set_tests_properties
(
test_parallel_ssa_graph_inference_feed_partial_data PROPERTIES TIMEOUT 120
)
set_tests_properties
(
test_parallel_ssa_graph_inference_feed_partial_data PROPERTIES TIMEOUT 120
)
set_tests_properties
(
test_parallel_executor_crf PROPERTIES TIMEOUT 120
)
set_tests_properties
(
test_parallel_executor_crf PROPERTIES TIMEOUT 120
)
set_tests_properties
(
test_tensordot PROPERTIES TIMEOUT 200
)
set_tests_properties
(
test_imperative_save_load PROPERTIES TIMEOUT 120
)
set_tests_properties
(
test_imperative_save_load PROPERTIES TIMEOUT 120
)
set_tests_properties
(
test_partial_eager_deletion_transformer PROPERTIES TIMEOUT 120
)
set_tests_properties
(
test_partial_eager_deletion_transformer PROPERTIES TIMEOUT 120
)
set_tests_properties
(
test_parallel_executor_seresnext_with_reduce_gpu PROPERTIES TIMEOUT 120
)
set_tests_properties
(
test_parallel_executor_seresnext_with_reduce_gpu PROPERTIES TIMEOUT 120
)
...
@@ -1233,9 +1234,6 @@ if(WITH_GPU OR WITH_ROCM)
...
@@ -1233,9 +1234,6 @@ if(WITH_GPU OR WITH_ROCM)
endif
()
endif
()
set_tests_properties
(
test_inplace_addto_strategy PROPERTIES TIMEOUT 120
)
set_tests_properties
(
test_inplace_addto_strategy PROPERTIES TIMEOUT 120
)
set_tests_properties
(
test_eigvals_op PROPERTIES TIMEOUT 400
)
set_tests_properties
(
test_eigvals_op PROPERTIES TIMEOUT 400
)
set_tests_properties
(
test_tensordot PROPERTIES TIMEOUT 1000
)
set_tests_properties
(
test_tensordot PROPERTIES LABELS
"RUN_TYPE=NIGHTLY"
)
set_tests_properties
(
test_tensordot PROPERTIES ENVIRONMENT
"FLAGS_USE_STANDALONE_EXECUTOR=False"
)
set_tests_properties
(
test_cuda_memory_reserved PROPERTIES ENVIRONMENT
"FLAGS_allocator_strategy=auto_growth"
)
set_tests_properties
(
test_cuda_memory_reserved PROPERTIES ENVIRONMENT
"FLAGS_allocator_strategy=auto_growth"
)
if
(
WITH_GLOO
)
if
(
WITH_GLOO
)
set_tests_properties
(
test_parallel_dygraph_dataparallel_cpuonly PROPERTIES TIMEOUT 30
)
set_tests_properties
(
test_parallel_dygraph_dataparallel_cpuonly PROPERTIES TIMEOUT 30
)
...
...
python/paddle/fluid/tests/unittests/test_tensordot.py
浏览文件 @
757b5d31
...
@@ -12,13 +12,12 @@
...
@@ -12,13 +12,12 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
import
paddle
import
unittest
import
paddle.fluid.core
as
core
import
numpy
as
np
import
itertools
as
it
import
itertools
as
it
import
numpy
as
np
import
unittest
np
.
set_printoptions
(
threshold
=
np
.
inf
)
import
paddle
import
paddle.fluid.core
as
core
def
tensordot_np
(
x
,
y
,
axes
):
def
tensordot_np
(
x
,
y
,
axes
):
...
@@ -68,9 +67,16 @@ def tensordot_np(x, y, axes):
...
@@ -68,9 +67,16 @@ def tensordot_np(x, y, axes):
class
TestTensordotAPI
(
unittest
.
TestCase
):
class
TestTensordotAPI
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
set_place
()
self
.
set_dtype
()
self
.
set_dtype
()
self
.
set_input_shape
()
self
.
set_input_shape
()
self
.
set_input_data
()
self
.
set_input_data
()
self
.
set_test_axes
()
def
set_place
(
self
):
self
.
places
=
[
core
.
CPUPlace
()]
if
core
.
is_compiled_with_cuda
():
self
.
places
.
append
(
core
.
CUDAPlace
(
0
))
def
set_dtype
(
self
):
def
set_dtype
(
self
):
self
.
dtype
=
np
.
float32
self
.
dtype
=
np
.
float32
...
@@ -82,33 +88,8 @@ class TestTensordotAPI(unittest.TestCase):
...
@@ -82,33 +88,8 @@ class TestTensordotAPI(unittest.TestCase):
def
set_input_data
(
self
):
def
set_input_data
(
self
):
self
.
x
=
np
.
random
.
random
(
self
.
x_shape
).
astype
(
self
.
dtype
)
self
.
x
=
np
.
random
.
random
(
self
.
x_shape
).
astype
(
self
.
dtype
)
self
.
y
=
np
.
random
.
random
(
self
.
y_shape
).
astype
(
self
.
dtype
)
self
.
y
=
np
.
random
.
random
(
self
.
y_shape
).
astype
(
self
.
dtype
)
self
.
all_axes
=
[
2
]
def
run_dygraph
(
self
,
place
):
def
set_test_axes
(
self
):
paddle
.
disable_static
()
x
=
paddle
.
to_tensor
(
self
.
x
,
place
=
place
)
y
=
paddle
.
to_tensor
(
self
.
y
,
place
=
place
)
paddle_res
=
paddle
.
tensordot
(
x
,
y
,
self
.
axes
)
np_res
=
tensordot_np
(
self
.
x
,
self
.
y
,
self
.
axes
)
np
.
testing
.
assert_allclose
(
paddle_res
,
np_res
,
rtol
=
1e-6
)
def
run_static
(
self
,
place
):
paddle
.
enable_static
()
with
paddle
.
static
.
program_guard
(
paddle
.
static
.
Program
(),
paddle
.
static
.
Program
()):
x
=
paddle
.
static
.
data
(
name
=
'x'
,
shape
=
self
.
x_shape
,
dtype
=
self
.
dtype
)
y
=
paddle
.
static
.
data
(
name
=
'y'
,
shape
=
self
.
y_shape
,
dtype
=
self
.
dtype
)
z
=
paddle
.
tensordot
(
x
,
y
,
self
.
axes
)
exe
=
paddle
.
static
.
Executor
(
place
)
paddle_res
=
exe
.
run
(
feed
=
{
'x'
:
self
.
x
,
'y'
:
self
.
y
},
fetch_list
=
[
z
])
np_res
=
tensordot_np
(
self
.
x
,
self
.
y
,
self
.
axes
)
np
.
testing
.
assert_allclose
(
paddle_res
[
0
],
np_res
,
rtol
=
1e-6
)
def
test_cases
(
self
):
self
.
all_axes
=
[]
self
.
all_axes
=
[]
axial_index
=
range
(
4
)
axial_index
=
range
(
4
)
all_permutations
=
list
(
it
.
permutations
(
axial_index
,
0
))
+
list
(
all_permutations
=
list
(
it
.
permutations
(
axial_index
,
0
))
+
list
(
...
@@ -136,57 +117,146 @@ class TestTensordotAPI(unittest.TestCase):
...
@@ -136,57 +117,146 @@ class TestTensordotAPI(unittest.TestCase):
self
.
all_axes
.
extend
(
range
(
5
))
self
.
all_axes
.
extend
(
range
(
5
))
places
=
[
core
.
CPUPlace
()]
def
test_dygraph
(
self
):
if
core
.
is_compiled_with_cuda
():
paddle
.
disable_static
()
places
.
append
(
core
.
CUDAPlace
(
0
))
for
axes
in
self
.
all_axes
:
for
place
in
self
.
places
:
x
=
paddle
.
to_tensor
(
self
.
x
,
place
=
place
)
y
=
paddle
.
to_tensor
(
self
.
y
,
place
=
place
)
paddle_res
=
paddle
.
tensordot
(
x
,
y
,
axes
)
np_res
=
tensordot_np
(
self
.
x
,
self
.
y
,
axes
)
np
.
testing
.
assert_allclose
(
paddle_res
,
np_res
,
rtol
=
1e-6
)
def
test_static
(
self
):
paddle
.
enable_static
()
for
axes
in
self
.
all_axes
:
for
axes
in
self
.
all_axes
:
self
.
axes
=
axes
for
place
in
self
.
places
:
for
place
in
places
:
with
paddle
.
static
.
program_guard
(
paddle
.
static
.
Program
(),
self
.
run_dygraph
(
place
)
paddle
.
static
.
Program
()):
self
.
run_static
(
place
)
x
=
paddle
.
static
.
data
(
name
=
'x'
,
shape
=
self
.
x_shape
,
dtype
=
self
.
dtype
)
y
=
paddle
.
static
.
data
(
name
=
'y'
,
shape
=
self
.
y_shape
,
dtype
=
self
.
dtype
)
z
=
paddle
.
tensordot
(
x
,
y
,
axes
)
exe
=
paddle
.
static
.
Executor
(
place
)
paddle_res
=
exe
.
run
(
feed
=
{
'x'
:
self
.
x
,
'y'
:
self
.
y
},
fetch_list
=
[
z
])
np_res
=
tensordot_np
(
self
.
x
,
self
.
y
,
axes
)
np
.
testing
.
assert_allclose
(
paddle_res
[
0
],
np_res
,
rtol
=
1e-6
)
class
TestTensordotAPIFloat64
(
TestTensordotAPI
):
class
TestTensordotAPIFloat64
(
TestTensordotAPI
):
# Only test a small part of axes case for Float64 type
def
set_test_axes
(
self
):
self
.
all_axes
=
[
[[
3
,
2
],
[
3
]],
[[
2
,
1
,
0
],
[
2
,
1
]],
[[
1
,
2
,
0
],
[
1
,
3
,
2
]],
[
3
,
0
],
[[],
[
0
,
3
,
1
]],
[[
2
,
1
,
0
,
3
],
[
2
,
0
,
1
,
3
]],
[[
3
,
1
,
2
],
[
1
,
3
,
2
,
0
]],
[[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
0
,
2
,
1
]],
[[
1
,
3
,
0
],
[
3
,
0
,
2
]],
[[
3
,
1
,
2
],
[
1
,
2
,
3
]],
[[
3
,
1
,
2
],
[
3
,
1
,
0
]],
[[
0
,
3
,
1
,
2
],
[
3
,
2
,
1
,
0
]],
[[
0
,
3
],
[
3
,
2
,
1
]],
[[
2
,
3
],
[
1
,
3
,
0
]],
[[
0
,
3
,
2
],
[
2
,
0
,
3
,
1
]],
[[
2
,
3
],
[
1
,
3
]],
[[
3
,
1
,
2
,
0
],
[
2
,
3
,
1
,
0
]],
[[
1
,
0
,
3
,
2
],
[
3
,
0
,
1
,
2
]],
[[
3
,
2
,
1
,
0
],
[
0
,
1
,
3
,
2
]],
[[
3
,
1
,
2
],
[
3
]],
[[
0
,
1
,
3
,
2
],
[
2
,
3
,
0
,
1
]],
[[
1
,
2
,
3
,
0
],
[
1
,
3
,
0
,
2
]],
[
3
,
1
,
2
],
[[
3
,
1
,
2
],
[
0
,
3
,
2
]],
[[
2
,
3
,
0
],
[
1
,
2
,
0
]],
[[
2
,
0
,
3
],
[
2
,
0
]],
[[
3
,
1
,
0
,
2
],
[
3
,
1
,
0
,
2
]],
[[
0
,
1
,
2
],
[
2
,
0
,
1
]],
[[
1
,
0
,
3
],
[
2
,
3
,
0
]],
[[
2
,
0
,
1
],
[
0
,
1
,
3
]],
[[
2
,
1
],
[
0
,
1
,
3
]]
]
def
set_dtype
(
self
):
def
set_dtype
(
self
):
self
.
dtype
=
np
.
float64
self
.
dtype
=
np
.
float64
class
TestTensordotAPIBroadcastCase1
(
TestTensordotAPIFloat64
):
def
set_input_shape
(
self
):
self
.
x_shape
=
[
1
,
1
,
1
,
5
]
self
.
y_shape
=
[
1
,
5
,
1
,
1
]
class
TestTensordotAPIBroadcastCase2
(
TestTensordotAPIFloat64
):
def
set_input_shape
(
self
):
self
.
x_shape
=
[
1
,
5
,
5
,
5
]
self
.
y_shape
=
[
1
,
1
,
1
,
5
]
class
TestTensordotAPIBroadcastCase3
(
TestTensordotAPIFloat64
):
def
set_input_shape
(
self
):
self
.
x_shape
=
[
5
,
5
,
5
,
1
]
self
.
y_shape
=
[
5
,
5
,
1
,
5
]
class
TestTensordotAPIBroadcastCase4
(
TestTensordotAPIFloat64
):
def
set_input_shape
(
self
):
self
.
x_shape
=
[
5
,
5
,
5
,
1
]
self
.
y_shape
=
[
1
,
1
,
1
,
1
]
class
TestTensordotAPIBroadcastCase5
(
TestTensordotAPIFloat64
):
def
set_input_shape
(
self
):
self
.
x_shape
=
[
1
,
1
,
5
,
5
]
self
.
y_shape
=
[
5
,
5
,
1
,
5
]
class
TestTensordotAPIAxesType
(
TestTensordotAPI
):
class
TestTensordotAPIAxesType
(
TestTensordotAPI
):
def
set_input_shape
(
self
):
def
set_input_shape
(
self
):
self
.
x_shape
=
[
3
,
4
,
4
]
self
.
x_shape
=
[
3
,
4
,
4
]
self
.
y_shape
=
[
4
,
4
,
5
]
self
.
y_shape
=
[
4
,
4
,
5
]
def
test_cas
es
(
self
):
def
set_test_ax
es
(
self
):
self
.
all_axes
=
[
self
.
all_axes
=
[
0
,
1
,
2
,
(
1
,
),
[
1
],
((
1
,
),
),
([
1
],
),
((
2
,
1
),
(
0
,
)),
(
0
,
1
,
2
,
(
1
,
),
[
1
],
((
1
,
),
),
([
1
],
),
((
2
,
1
),
(
0
,
)),
(
(
1
,
2
),
(
0
,
1
)),
([
1
,
2
],
[
0
,
1
]),
([
1
,
2
],
[
0
,
1
]),
(
1
,
2
),
(
0
,
1
)),
([
1
,
2
],
[
0
,
1
]),
([
1
,
2
],
[
0
,
1
]),
[[
1
,
2
],
[
0
,
1
]]
[[
1
,
2
],
[
0
,
1
]]
]
]
places
=
[
core
.
CPUPlace
()]
def
test_tensor_axes
(
self
):
if
core
.
is_compiled_with_cuda
():
places
.
append
(
core
.
CUDAPlace
(
0
))
for
axes
in
self
.
all_axes
:
self
.
axes
=
axes
for
place
in
places
:
self
.
run_dygraph
(
place
)
self
.
run_static
(
place
)
# The 'axes' with type 'Tensor' in tensordot is not available in static mode
# The 'axes' with type 'Tensor' in tensordot is not available in static mode
paddle
.
disable_static
()
paddle
.
disable_static
()
for
place
in
places
:
tensor_axes
=
[
self
.
all_axes
=
[
paddle
.
to_tensor
([
1
]),
(
paddle
.
to_tensor
([
1
])),
paddle
.
to_tensor
([
1
]),
(
paddle
.
to_tensor
([
1
])),
(
paddle
.
to_tensor
([
1
,
2
]),
paddle
.
to_tensor
([
0
,
1
])),
(
paddle
.
to_tensor
([
1
,
2
]),
paddle
.
to_tensor
([
0
,
1
])),
[
paddle
.
to_tensor
([
1
,
2
]),
paddle
.
to_tensor
([
0
,
1
])],
[
paddle
.
to_tensor
([
1
,
2
]),
paddle
.
to_tensor
([
0
,
1
])],
paddle
.
to_tensor
([[
1
,
2
],
[
0
,
1
]])
paddle
.
to_tensor
([[
1
,
2
],
[
0
,
1
]])
]
]
for
axes
in
self
.
all_axes
:
for
place
in
self
.
places
:
self
.
axes
=
axes
for
axes
in
tensor_axes
:
for
place
in
places
:
x
=
paddle
.
to_tensor
(
self
.
x
,
place
=
place
)
self
.
run_dygraph
(
place
)
y
=
paddle
.
to_tensor
(
self
.
y
,
place
=
place
)
paddle_res
=
paddle
.
tensordot
(
x
,
y
,
axes
)
np_res
=
tensordot_np
(
self
.
x
,
self
.
y
,
axes
)
np
.
testing
.
assert_allclose
(
paddle_res
,
np_res
,
rtol
=
1e-6
)
def
test_error
(
self
):
def
test_error
(
self
):
self
.
all_axes
=
[[[[
0
],
[
1
]]],
0.1
,
-
1
,
100
,
[[
1
,
2
],
[
0
,
0
]],
self
.
all_axes
=
[[[[
0
],
[
1
]]],
0.1
,
-
1
,
100
,
[[
1
,
2
],
[
0
,
0
]],
...
@@ -204,35 +274,5 @@ class TestTensordotAPIAxesTypeFloat64(TestTensordotAPIAxesType):
...
@@ -204,35 +274,5 @@ class TestTensordotAPIAxesTypeFloat64(TestTensordotAPIAxesType):
self
.
dtype
=
np
.
float64
self
.
dtype
=
np
.
float64
class
TestTensordotAPIBroadcastCase1
(
TestTensordotAPI
):
def
set_input_shape
(
self
):
self
.
x_shape
=
[
1
,
1
,
1
,
5
]
self
.
y_shape
=
[
1
,
5
,
1
,
1
]
class
TestTensordotAPIBroadcastCase2
(
TestTensordotAPI
):
def
set_input_shape
(
self
):
self
.
x_shape
=
[
1
,
5
,
5
,
5
]
self
.
y_shape
=
[
1
,
1
,
1
,
5
]
class
TestTensordotAPIBroadcastCase3
(
TestTensordotAPI
):
def
set_input_shape
(
self
):
self
.
x_shape
=
[
5
,
5
,
5
,
1
]
self
.
y_shape
=
[
5
,
5
,
1
,
5
]
class
TestTensordotAPIBroadcastCase4
(
TestTensordotAPI
):
def
set_input_shape
(
self
):
self
.
x_shape
=
[
5
,
5
,
5
,
1
]
self
.
y_shape
=
[
1
,
1
,
1
,
1
]
class
TestTensordotAPIBroadcastCase5
(
TestTensordotAPI
):
def
set_input_shape
(
self
):
self
.
x_shape
=
[
1
,
1
,
5
,
5
]
self
.
y_shape
=
[
5
,
5
,
1
,
5
]
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
unittest
.
main
()
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录