未验证 提交 b5766fbf 编写于 作者: C Chen Weihang 提交者: GitHub

polish kernel type str (#42791) (#42931)

上级 d5b6eec2
...@@ -82,9 +82,9 @@ class OpKernelType { ...@@ -82,9 +82,9 @@ class OpKernelType {
inline std::ostream& operator<<(std::ostream& os, inline std::ostream& operator<<(std::ostream& os,
const OpKernelType& kernel_key) { const OpKernelType& kernel_key) {
os << "data_type[" << kernel_key.data_type_ << "]:data_layout[" os << "{data_type[" << kernel_key.data_type_ << "]; data_layout["
<< kernel_key.data_layout_ << "]:place[" << kernel_key.place_ << kernel_key.data_layout_ << "]; place[" << kernel_key.place_
<< "]:library_type[" << kernel_key.library_type_ << "]"; << "]; library_type[" << kernel_key.library_type_ << "]}";
return os; return os;
} }
......
...@@ -27,16 +27,15 @@ TEST(OpKernelType, ToString) { ...@@ -27,16 +27,15 @@ TEST(OpKernelType, ToString) {
LibraryType::kCUDNN); LibraryType::kCUDNN);
ASSERT_EQ(paddle::framework::KernelTypeToString(op_kernel_type), ASSERT_EQ(paddle::framework::KernelTypeToString(op_kernel_type),
"data_type[float]:data_layout[NCHW]:place[Place(cpu)]:library_type[" "{data_type[float]; data_layout[NCHW]; place[Place(cpu)]; "
"CUDNN]"); "library_type[CUDNN]}");
using CUDAPlace = paddle::platform::CUDAPlace; using CUDAPlace = paddle::platform::CUDAPlace;
OpKernelType op_kernel_type2(DataType::FP16, CUDAPlace(0), DataLayout::kNCHW, OpKernelType op_kernel_type2(DataType::FP16, CUDAPlace(0), DataLayout::kNCHW,
LibraryType::kCUDNN); LibraryType::kCUDNN);
ASSERT_EQ(paddle::framework::KernelTypeToString(op_kernel_type2), ASSERT_EQ(paddle::framework::KernelTypeToString(op_kernel_type2),
"data_type[::paddle::platform::float16]:data_layout[NCHW]:place[" "{data_type[::paddle::platform::float16]; data_layout[NCHW]; "
"Place(gpu:0)]:library_" "place[Place(gpu:0)]; library_type[CUDNN]}");
"type[CUDNN]");
} }
TEST(OpKernelType, Hash) { TEST(OpKernelType, Hash) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册