Skip to content

Commit 8955901

Browse files
hsharma35facebook-github-bot
authored andcommitted
Improve error message in method.cpp (#7642)
Summary: Use `::executorch::runtime::toString` to print string scalar type instead of a number. Reviewed By: tarun292 Differential Revision: D68130648
1 parent cd0fcc2 commit 8955901

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

runtime/executor/method.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -833,11 +833,10 @@ Method::set_input(const EValue& input_evalue, size_t input_idx) {
833833
ET_CHECK_OR_RETURN_ERROR(
834834
t_dst.scalar_type() == t_src.scalar_type(),
835835
InvalidArgument,
836-
"The %zu-th input tensor's scalartype does not meet requirement: found %" PRId8
837-
" but expected %" PRId8,
836+
"The %zu-th input tensor's scalartype does not meet requirement: found %s but expected %s",
838837
input_idx,
839-
static_cast<int8_t>(t_src.scalar_type()),
840-
static_cast<int8_t>(t_dst.scalar_type()));
838+
::executorch::runtime::toString(t_src.scalar_type()),
839+
::executorch::runtime::toString(t_dst.scalar_type()));
841840
// Reset the shape for the Method's input as the size of forwarded input
842841
// tensor for shape dynamism. Also is a safety check if need memcpy.
843842
Error err = resize_tensor(t_dst, t_src.sizes());

0 commit comments

Comments
 (0)