Skip to content

Commit

Permalink
Improve message when input tensor mismatch is detected.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 689723445
  • Loading branch information
MediaPipe Team authored and copybara-github committed Oct 25, 2024
1 parent 76e52c7 commit 214f441
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mediapipe/calculators/tensor/inference_calculator_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,11 @@ absl::Status CopyCpuInputIntoTfLiteTensor(const Tensor& input_tensor,
const Tensor::ElementType input_tensor_type = input_tensor.element_type();
RET_CHECK(input_tensor_type == interpreter_tensor_type)
.SetCode(absl::StatusCode::kInvalidArgument)
<< "Input and interpreter tensor type do not match.";
<< absl::StrFormat(
"Input and interpreter tensor type do not match: Input tensor "
"type %s vs interpreter tensor type %s.",
GetTensorTypeString(input_tensor_type),
TfLiteTypeGetName(interpreter_tensor_type));
switch (interpreter_tensor_type) {
case TfLiteType::kTfLiteFloat16:
case TfLiteType::kTfLiteFloat32: {
Expand Down

0 comments on commit 214f441

Please sign in to comment.