Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cherry-pick] Polish kernel type str (#42791) #42931

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions paddle/fluid/framework/op_kernel_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ class OpKernelType {

inline std::ostream& operator<<(std::ostream& os,
const OpKernelType& kernel_key) {
os << "data_type[" << kernel_key.data_type_ << "]:data_layout["
<< kernel_key.data_layout_ << "]:place[" << kernel_key.place_
<< "]:library_type[" << kernel_key.library_type_ << "]";
os << "{data_type[" << kernel_key.data_type_ << "]; data_layout["
<< kernel_key.data_layout_ << "]; place[" << kernel_key.place_
<< "]; library_type[" << kernel_key.library_type_ << "]}";
return os;
}

Expand Down
9 changes: 4 additions & 5 deletions paddle/fluid/framework/op_kernel_type_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ TEST(OpKernelType, ToString) {
LibraryType::kCUDNN);

ASSERT_EQ(paddle::framework::KernelTypeToString(op_kernel_type),
"data_type[float]:data_layout[NCHW]:place[Place(cpu)]:library_type["
"CUDNN]");
"{data_type[float]; data_layout[NCHW]; place[Place(cpu)]; "
"library_type[CUDNN]}");

using CUDAPlace = paddle::platform::CUDAPlace;
OpKernelType op_kernel_type2(DataType::FP16, CUDAPlace(0), DataLayout::kNCHW,
LibraryType::kCUDNN);
ASSERT_EQ(paddle::framework::KernelTypeToString(op_kernel_type2),
"data_type[::paddle::platform::float16]:data_layout[NCHW]:place["
"Place(gpu:0)]:library_"
"type[CUDNN]");
"{data_type[::paddle::platform::float16]; data_layout[NCHW]; "
"place[Place(gpu:0)]; library_type[CUDNN]}");
}

TEST(OpKernelType, Hash) {
Expand Down