diff --git a/runtime/executor/method.cpp b/runtime/executor/method.cpp index 674af6d69f9..146c3640669 100644 --- a/runtime/executor/method.cpp +++ b/runtime/executor/method.cpp @@ -830,14 +830,14 @@ Method::set_input(const EValue& input_evalue, size_t input_idx) { if (e.isTensor()) { const auto& t_dst = e.toTensor(); const auto& t_src = input_evalue.toTensor(); + ET_CHECK_OR_RETURN_ERROR( t_dst.scalar_type() == t_src.scalar_type(), InvalidArgument, - "The %zu-th input tensor's scalartype does not meet requirement: found %" PRId8 - " but expected %" PRId8, + "Input %zu has unexpected scalar type: expected %s but was %s.", input_idx, - static_cast(t_src.scalar_type()), - static_cast(t_dst.scalar_type())); + executorch::runtime::toString(t_dst.scalar_type()), + executorch::runtime::toString(t_src.scalar_type())); // Reset the shape for the Method's input as the size of forwarded input // tensor for shape dynamism. Also is a safety check if need memcpy. Error err = resize_tensor(t_dst, t_src.sizes()); diff --git a/runtime/executor/targets.bzl b/runtime/executor/targets.bzl index cc91255d7b5..158da5d1087 100644 --- a/runtime/executor/targets.bzl +++ b/runtime/executor/targets.bzl @@ -82,6 +82,7 @@ def define_common_targets(): "//executorch/runtime/core:evalue" + aten_suffix, "//executorch/runtime/core:event_tracer" + aten_suffix, "//executorch/runtime/core/exec_aten:lib" + aten_suffix, + "//executorch/runtime/core/exec_aten/util:scalar_type_util" + aten_suffix, "//executorch/runtime/core/exec_aten/util:tensor_util" + aten_suffix, "//executorch/runtime/kernel:kernel_runtime_context" + aten_suffix, "//executorch/runtime/kernel:operator_registry",