#include "tensorflow_lite_support/cc/task/text/text_embedder.h"
#include "absl/status/status.h"
#include "tensorflow_lite_support/cc/common.h"
#include "tensorflow_lite_support/cc/port/status_macros.h"
#include "tensorflow_lite_support/cc/port/statusor.h"
#include "tensorflow_lite_support/cc/task/core/task_api_factory.h"
#include "tensorflow_lite_support/cc/task/processor/bert_preprocessor.h"
#include "tensorflow_lite_support/cc/task/processor/regex_preprocessor.h"
#include "tensorflow_lite_support/cc/task/processor/text_preprocessor.h"
#include "tensorflow_lite_support/cc/task/processor/universal_sentence_encoder_preprocessor.h"
#include "tensorflow_lite_support/cc/task/text/utils/bert_utils.h"
#include "tensorflow_lite_support/cc/task/text/utils/universal_sentence_encoder_utils.h"
namespace tflite {
namespace task {
namespace text {
namespace {
StatusCode;
CreateStatusWithPayload;
StatusOr;
TfLiteSupportStatus;
TaskAPIFactory;
EmbeddingResult;
FeatureVector;
constexpr int kUSEResponseEncodingIndex = …;
absl::Status SanityCheckOptions(const TextEmbedderOptions& options) { … }
}
tflite::support::StatusOr<double> TextEmbedder::CosineSimilarity(
const FeatureVector& u, const FeatureVector& v) { … }
tflite::support::StatusOr<std::unique_ptr<TextEmbedder>>
TextEmbedder::CreateFromOptions(const TextEmbedderOptions& options,
std::unique_ptr<tflite::OpResolver> resolver) { … }
absl::Status TextEmbedder::Init(std::unique_ptr<TextEmbedderOptions> options) { … }
tflite::support::StatusOr<EmbeddingResult> TextEmbedder::Embed(
const std::string& text) { … }
absl::Status TextEmbedder::Preprocess(
const std::vector<TfLiteTensor*>& input_tensors, const std::string& input) { … }
tflite::support::StatusOr<EmbeddingResult> TextEmbedder::Postprocess(
const std::vector<const TfLiteTensor*>& output_tensors,
const std::string& input) { … }
int TextEmbedder::GetEmbeddingDimension(int output_index) const { … }
int TextEmbedder::GetNumberOfOutputLayers() const { … }
}
}
}