#include "tensorflow_lite_support/cc/task/text/nlclassifier/nl_classifier.h"
#include <cstddef>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "absl/algorithm/container.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "flatbuffers/flatbuffers.h"
#include "tensorflow/lite/c/common.h"
#include "tensorflow/lite/core/api/op_resolver.h"
#include "tensorflow/lite/kernels/internal/tensor_ctypes.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/category.h"
#include "tensorflow_lite_support/cc/task/core/task_api_factory.h"
#include "tensorflow_lite_support/cc/task/core/task_utils.h"
#include "tensorflow_lite_support/cc/utils/common_utils.h"
namespace tflite {
namespace task {
namespace text {
namespace nlclassifier {
StatusCode;
Offset;
Vector;
TensorMetadata;
CreateStatusWithPayload;
StatusOr;
TfLiteSupportStatus;
LoadVocabFromBuffer;
Category;
Dequantize;
GetStringAtIndex;
TaskAPIFactory;
NLClassifierProtoOptions;
namespace {
absl::Status SanityCheckOptions(const NLClassifierProtoOptions& options) { … }
}
const NLClassifierOptions& NLClassifier::GetOptions() const { … }
absl::Status NLClassifier::TrySetLabelFromMetadata(
const TensorMetadata* metadata) { … }
std::vector<Category> NLClassifier::Classify(const std::string& text) { … }
StatusOr<std::vector<Category>> NLClassifier::ClassifyText(
const std::string& text) { … }
absl::Status NLClassifier::Preprocess(
const std::vector<TfLiteTensor*>& input_tensors, const std::string& input) { … }
StatusOr<std::vector<Category>> NLClassifier::Postprocess(
const std::vector<const TfLiteTensor*>& output_tensors,
const std::string& ) { … }
std::vector<Category> NLClassifier::BuildResults(const TfLiteTensor* scores,
const TfLiteTensor* labels) { … }
absl::Status NLClassifier::Initialize(
std::unique_ptr<tflite::task::text::NLClassifierOptions> options) { … }
absl::Status NLClassifier::Initialize(const NLClassifierOptions& options) { … }
StatusOr<std::unique_ptr<NLClassifier>> NLClassifier::CreateFromOptions(
const NLClassifierProtoOptions& options,
std::unique_ptr<tflite::OpResolver> resolver) { … }
StatusOr<std::unique_ptr<NLClassifier>>
NLClassifier::CreateFromBufferAndOptions(
const char* model_buffer_data, size_t model_buffer_size,
const NLClassifierOptions& options,
std::unique_ptr<tflite::OpResolver> resolver) { … }
StatusOr<std::unique_ptr<NLClassifier>> NLClassifier::CreateFromFileAndOptions(
const std::string& path_to_model, const NLClassifierOptions& options,
std::unique_ptr<tflite::OpResolver> resolver) { … }
StatusOr<std::unique_ptr<NLClassifier>> NLClassifier::CreateFromFdAndOptions(
int fd, const NLClassifierOptions& options,
std::unique_ptr<tflite::OpResolver> resolver) { … }
}
}
}
}