Skip to content

Commit

Permalink
better error message
Browse files Browse the repository at this point in the history
  • Loading branch information
RedContritio committed Jun 14, 2023
1 parent ec82ff8 commit 058846a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions paddle/phi/core/infermeta_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,13 @@ const AttrType& InferMetaContext::AttrAt(size_t idx) const {
try {
return paddle::get<AttrType>(attrs_.at(idx));
} catch (paddle::bad_variant_access const& e) {
PADDLE_THROW(phi::errors::InvalidArgument(
"Attribute cast error in InferMeta Context, the expected attribute "
"type is `%s`.",
std::type_index(typeid(AttrType)).name()));
PADDLE_THROW(
phi::errors::InvalidArgument("Attribute [%d] cast error in InferMeta "
"Context, the expected attribute "
"type is `%s`, but received `%s`.",
idx,
std::type_index(typeid(AttrType)).name(),
attrs_.at(idx).type().name()));
}
}

Expand Down

0 comments on commit 058846a

Please sign in to comment.