18 #ifndef TENSORFLOW_SERVING_SERVABLES_TENSORFLOW_CLASSIFIER_H_
19 #define TENSORFLOW_SERVING_SERVABLES_TENSORFLOW_CLASSIFIER_H_
23 #include "absl/types/optional.h"
24 #include "tensorflow/cc/saved_model/loader.h"
25 #include "tensorflow/core/lib/core/status.h"
26 #include "tensorflow/core/platform/threadpool_options.h"
27 #include "tensorflow_serving/apis/classifier.h"
29 namespace tensorflow {
34 Status CreateClassifierFromSavedModelBundle(
35 const RunOptions& run_options, std::unique_ptr<SavedModelBundle> bundle,
36 std::unique_ptr<ClassifierInterface>* service);
43 Status CreateFlyweightTensorFlowClassifier(
44 const RunOptions& run_options, Session* session,
45 const SignatureDef* signature,
46 std::unique_ptr<ClassifierInterface>* service);
49 Status CreateFlyweightTensorFlowClassifier(
50 const RunOptions& run_options, Session* session,
51 const SignatureDef* signature,
52 const thread::ThreadPoolOptions& thread_pool_options,
53 std::unique_ptr<ClassifierInterface>* service);
59 Status GetClassificationSignatureDef(
const ModelSpec& model_spec,
60 const MetaGraphDef& meta_graph_def,
61 SignatureDef* signature);
69 Status PreProcessClassification(
const SignatureDef& signature,
70 string* input_tensor_name,
71 std::vector<string>* output_tensor_names);
74 Status PostProcessClassificationResult(
75 const SignatureDef& signature,
int num_examples,
76 const std::vector<string>& output_tensor_names,
77 const std::vector<Tensor>& output_tensors, ClassificationResult* result);
80 Status RunClassify(
const RunOptions& run_options,
81 const MetaGraphDef& meta_graph_def,
82 const absl::optional<int64_t>& servable_version,
83 Session* session,
const ClassificationRequest& request,
84 ClassificationResponse* response,
85 const thread::ThreadPoolOptions& thread_pool_options =
86 thread::ThreadPoolOptions());