TensorFlow Serving C++ API Documentation
tfrt_regressor.h
1 /* Copyright 2020 Google Inc. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7  http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 // TensorFlow implementation of the RegressorInterface.
17 
18 #ifndef TENSORFLOW_SERVING_SERVABLES_TENSORFLOW_TFRT_REGRESSOR_H_
19 #define TENSORFLOW_SERVING_SERVABLES_TENSORFLOW_TFRT_REGRESSOR_H_
20 
21 #include <memory>
22 
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/core/tfrt/saved_model/saved_model.h"
28 #include "tensorflow_serving/apis/regressor.h"
29 
30 namespace tensorflow {
31 namespace serving {
32 // Validate function's input and output.
33 Status PreProcessRegression(const tfrt::FunctionMetadata& function_metadata);
34 
35 // Validate all results and populate a RegressionResult.
36 Status PostProcessRegressionResult(
37  int num_examples, const std::vector<string>& output_tensor_names,
38  const std::vector<Tensor>& output_tensors, RegressionResult* result);
39 
40 // Run Regression.
41 Status RunRegress(const tfrt::SavedModel::RunOptions& run_options,
42  const absl::optional<int64_t>& servable_version,
43  tfrt::SavedModel* saved_model,
44  const RegressionRequest& request,
45  RegressionResponse* response);
46 
47 } // namespace serving
48 } // namespace tensorflow
49 
50 #endif // TENSORFLOW_SERVING_SERVABLES_TENSORFLOW_TFRT_REGRESSOR_H_