message: Add checks for Tensor dims.
diff: @@ -99,6 +99,17 @@ absl::Status ImagePreprocessor::Preprocess(const FrameBuffer& frame_buffer,
  std::unique_ptr<FrameBuffer> preprocessed_frame_buffer;
  std::vector<uint8> preprocessed_data;
  + if (Tensor()->dims->data[0] != 1 || Tensor()->dims->data[3] != 3) {
  + return CreateStatusWithPayload(
  + StatusCode::kInvalidArgument,
  + absl::StrCat("The input tensor should have dimensions 1 x height x "
  + "width x 3. Got ",
  + Tensor()->dims->data[0], " x ", Tensor()->dims->data[1],
  + " x ", Tensor()->dims->data[2], " x ",
  + Tensor()->dims->data[3], "."),
  + TfLiteSupportStatus::kInvalidInputTensorDimensionsError);
  + }
  +
  if (IsImagePreprocessingNeeded(frame_buffer, roi)) {
  // Preprocess input image to fit model requirements.
  // For now RGB is the only color space supported, which is ensured by
  