16 #ifndef THIRD_PARTY_TENSORFLOW_SERVING_SERVABLES_TENSORFLOW_SAVED_MODEL_WARMUP_TEST_UTIL_H_
17 #define THIRD_PARTY_TENSORFLOW_SERVING_SERVABLES_TENSORFLOW_SAVED_MODEL_WARMUP_TEST_UTIL_H_
21 #include "tensorflow/core/lib/io/path.h"
22 #include "tensorflow/core/lib/io/record_writer.h"
23 #include "tensorflow/core/platform/status.h"
24 #include "tensorflow/core/protobuf/meta_graph.pb.h"
25 #include "tensorflow_serving/apis/classification.pb.h"
26 #include "tensorflow_serving/apis/inference.pb.h"
27 #include "tensorflow_serving/apis/input.pb.h"
28 #include "tensorflow_serving/apis/model.pb.h"
29 #include "tensorflow_serving/apis/predict.pb.h"
30 #include "tensorflow_serving/apis/prediction_log.pb.h"
31 #include "tensorflow_serving/apis/regression.pb.h"
32 #include "tensorflow_serving/servables/tensorflow/session_bundle_config.pb.h"
34 namespace tensorflow {
37 void PopulateInferenceTask(
const string& model_name,
38 const string& signature_name,
39 const string& method_name, InferenceTask* task);
41 void PopulateMultiInferenceRequest(MultiInferenceRequest* request);
43 void PopulatePredictRequest(PredictRequest* request);
45 void PopulateClassificationRequest(ClassificationRequest* request);
47 void PopulateRegressionRequest(RegressionRequest* request);
49 Status PopulatePredictionLog(PredictionLog* prediction_log,
50 PredictionLog::LogTypeCase log_type,
51 int num_repeated_values = 1);
53 Status WriteWarmupData(
const string& fname,
54 const std::vector<string>& warmup_records,
55 int num_warmup_records);
57 Status WriteWarmupDataAsSerializedProtos(
58 const string& fname,
const std::vector<string>& warmup_records,
59 int num_warmup_records);
61 Status AddMixedWarmupData(
62 std::vector<string>* warmup_records,
63 const std::vector<PredictionLog::LogTypeCase>& log_types = {
64 PredictionLog::kRegressLog, PredictionLog::kClassifyLog,
65 PredictionLog::kPredictLog, PredictionLog::kMultiInferenceLog});
67 Status AddToWarmupData(std::vector<string>* warmup_records,
68 PredictionLog::LogTypeCase log_type,
69 int num_repeated_values = 1);
72 SignatureDef CreateSignatureDef(
const string& method_name,
73 const std::vector<string>& input_names,
74 const std::vector<string>& output_names);
76 void AddSignatures(MetaGraphDef* meta_graph_def);