Skip to content

Commit d4d8f83

Browse files
authored
Merge pull request #12633 from chenwhql/demangle_type_name
Error message refine: add demangle api to attribute type
2 parents 1e961b1 + 7797e55 commit d4d8f83

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

paddle/fluid/framework/attribute.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ struct ExtractAttribute {
128128
attr_value = &boost::get<T>(attr);
129129
} catch (boost::bad_get& bad_get) {
130130
PADDLE_THROW("Cannot get attribute %s by type %s, its type is %s",
131-
attr_name_, typeid(T).name(), attr.type().name());
131+
attr_name_, paddle::platform::demangle(typeid(T).name()),
132+
paddle::platform::demangle(attr.type().name()));
132133
}
133134
return attr_value;
134135
}
@@ -160,7 +161,7 @@ struct ExtractAttribute<bool> {
160161
attr_value = &boost::get<bool>(attr);
161162
} catch (boost::bad_get& bad_get) {
162163
PADDLE_THROW("Cannot get attribute %s by type bool, its type is %s",
163-
attr_name_, attr.type().name());
164+
attr_name_, paddle::platform::demangle(attr.type().name()));
164165
}
165166
return attr_value;
166167
}
@@ -186,7 +187,7 @@ struct ExtractAttribute<int64_t> {
186187
attr_value = &boost::get<int64_t>(attr);
187188
} catch (boost::bad_get& bad_get) {
188189
PADDLE_THROW("Cannot get attribute %s by type int64_t, its type is %s",
189-
attr_name_, attr.type().name());
190+
attr_name_, paddle::platform::demangle(attr.type().name()));
190191
}
191192
return attr_value;
192193
}

0 commit comments

Comments
 (0)