Skip to content

Commit

Permalink
polish kernel type str (#42791)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenwhql committed May 23, 2022
1 parent 8484048 commit 8fb4bc5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
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

1 comment on commit 8fb4bc5

@paddle-bot-old
Copy link

@paddle-bot-old paddle-bot-old bot commented on 8fb4bc5 May 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵️ CI failures summary

🔍 PR: #42931 Commit ID: 8fb4bc5 contains failed CI.

🔹 Failed: PR-CI-ScienceTest-23

Unknown Failed
Unknown Failed

Please sign in to comment.