未验证 提交 f783b846 编写于 作者: A Aurelius84 提交者: GitHub

Move dim_test/ddim_test into tests directory (#39111)

Co-authored-by: NChen Weihang <chenweihang@baidu.com>
上级 def81b4f
...@@ -23,12 +23,6 @@ cc_library(infermeta_utils SRCS infermeta_utils.cc DEPS meta_tensor) ...@@ -23,12 +23,6 @@ cc_library(infermeta_utils SRCS infermeta_utils.cc DEPS meta_tensor)
cc_test(unroll_array_ops_test SRCS unroll_array_ops_test.cc) cc_test(unroll_array_ops_test SRCS unroll_array_ops_test.cc)
cc_library(ddim SRCS ddim.cc DEPS eigen3 boost enforce) cc_library(ddim SRCS ddim.cc DEPS eigen3 boost enforce)
cc_test(ddim_test SRCS ddim_test.cc DEPS ddim)
if(WITH_GPU)
nv_test(dim_test SRCS dim_test.cu DEPS ddim)
elseif(WITH_ROCM)
hip_test(dim_test SRCS dim_test.cu DEPS ddim)
endif()
cc_library(selected_rows SRCS selected_rows.cc DEPS dense_tensor mixed_vector enforce ddim) cc_library(selected_rows SRCS selected_rows.cc DEPS dense_tensor mixed_vector enforce ddim)
......
...@@ -4,6 +4,14 @@ cc_test(test_type_info SRCS test_type_info.cc) ...@@ -4,6 +4,14 @@ cc_test(test_type_info SRCS test_type_info.cc)
cc_test(test_convert_utils SRCS test_convert_utils.cc DEPS convert_utils) cc_test(test_convert_utils SRCS test_convert_utils.cc DEPS convert_utils)
cc_test(test_kernel_factory SRCS test_kernel_factory.cc DEPS kernel_factory scale_kernel) cc_test(test_kernel_factory SRCS test_kernel_factory.cc DEPS kernel_factory scale_kernel)
cc_test(test_pten_device_context SRCS test_device_context.cc DEPS pten_context cpu_context) cc_test(test_pten_device_context SRCS test_device_context.cc DEPS pten_context cpu_context)
cc_test(test_ddim SRCS test_ddim.cc DEPS ddim)
if(WITH_GPU)
nv_test(test_dim SRCS test_dim.cu DEPS ddim)
elseif(WITH_ROCM)
hip_test(test_dim SRCS test_dim.cu DEPS ddim)
endif()
cc_test(selected_rows_test SRCS test_selected_rows.cc DEPS selected_rows) cc_test(selected_rows_test SRCS test_selected_rows.cc DEPS selected_rows)
if(WITH_TESTING AND TEST selected_rows_test) if(WITH_TESTING AND TEST selected_rows_test)
set_tests_properties(selected_rows_test PROPERTIES TIMEOUT 120) set_tests_properties(selected_rows_test PROPERTIES TIMEOUT 120)
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "paddle/pten/core/ddim.h" #include "paddle/pten/core/ddim.h"
namespace pten {
namespace tests {
TEST(DDim, Equality) { TEST(DDim, Equality) {
// construct a DDim from an initialization list // construct a DDim from an initialization list
pten::framework::DDim ddim = pten::framework::make_ddim({9, 1, 5}); pten::framework::DDim ddim = pten::framework::make_ddim({9, 1, 5});
...@@ -81,3 +84,6 @@ TEST(DDim, Print) { ...@@ -81,3 +84,6 @@ TEST(DDim, Print) {
ss << ddim; ss << ddim;
EXPECT_EQ("2, 3, 4", ss.str()); EXPECT_EQ("2, 3, 4", ss.str());
} }
} // namespace tests
} // namespace pten
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "paddle/pten/core/dim.h" #include "paddle/pten/core/dim.h"
namespace pten {
namespace tests {
__global__ void test(pten::framework::Dim<2>* o) { __global__ void test(pten::framework::Dim<2>* o) {
o[0] = pten::framework::make_dim(5, 6); o[0] = pten::framework::make_dim(5, 6);
} }
...@@ -94,4 +97,7 @@ TEST(Dim, Print) { ...@@ -94,4 +97,7 @@ TEST(Dim, Print) {
ss << pten::framework::make_dim(8); ss << pten::framework::make_dim(8);
EXPECT_EQ(ss.str(), "8"); EXPECT_EQ(ss.str(), "8");
} }
} }
\ No newline at end of file
} // namespace tests
} // namespace pten
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册