chromium/third_party/mediapipe/src/mediapipe/tasks/cc/text/utils/text_model_utils.cc

/* Copyright 2022 The MediaPipe Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#include "mediapipe/tasks/cc/text/utils/text_model_utils.h"

#include "absl/algorithm/container.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/substitute.h"
#include "mediapipe/tasks/cc/common.h"
#include "mediapipe/tasks/cc/components/processors/proto/text_model_type.pb.h"
#include "mediapipe/tasks/cc/core/model_resources.h"
#include "mediapipe/tasks/cc/metadata/metadata_extractor.h"
#include "tensorflow/lite/schema/schema_generated.h"

namespace mediapipe::tasks::text::utils {
namespace {

using ::mediapipe::tasks::components::processors::proto::TextModelType;
ModelResources;
ModelMetadataExtractor;

constexpr int kNumInputTensorsForBert =;
constexpr int kNumInputTensorsForRegex =;
constexpr int kNumInputTensorsForStringPreprocessor =;
constexpr int kNumInputTensorsForUSE =;

// Determines the ModelType for a model with int32 input tensors based
// on the number of input tensors. Returns an error if there is missing metadata
// or an invalid number of input tensors.
absl::StatusOr<TextModelType::ModelType> GetIntTensorModelType(
    const ModelResources& model_resources, int num_input_tensors) {}

// Determines the ModelType for a model with string input tensors based
// on the number of input tensors. Returns an error if there is an invalid
// number of input tensors.
absl::StatusOr<TextModelType::ModelType> GetStringTensorModelType(
    const ModelResources& model_resources, int num_input_tensors) {}
}  // namespace

absl::StatusOr<TextModelType::ModelType> GetModelType(
    const ModelResources& model_resources) {}

}  // namespace mediapipe::tasks::text::utils