16 #include "tensorflow_serving/servables/tensorflow/regression_service.h"
18 #include "tensorflow/core/lib/core/errors.h"
19 #include "tensorflow/core/platform/tracing.h"
20 #include "tensorflow_serving/apis/regressor.h"
21 #include "tensorflow_serving/core/servable_handle.h"
22 #include "tensorflow_serving/servables/tensorflow/regressor.h"
23 #include "tensorflow_serving/servables/tensorflow/util.h"
25 namespace tensorflow {
28 Status TensorflowRegressionServiceImpl::Regress(
29 const RunOptions& run_options, ServerCore* core,
30 const thread::ThreadPoolOptions& thread_pool_options,
31 const RegressionRequest& request, RegressionResponse* response) {
33 if (!request.has_model_spec()) {
34 return tensorflow::Status(
35 static_cast<absl::StatusCode
>(absl::StatusCode::kInvalidArgument),
39 return RegressWithModelSpec(run_options, core, thread_pool_options,
40 request.model_spec(), request, response);
43 Status TensorflowRegressionServiceImpl::RegressWithModelSpec(
44 const RunOptions& run_options, ServerCore* core,
45 const thread::ThreadPoolOptions& thread_pool_options,
46 const ModelSpec& model_spec,
const RegressionRequest& request,
47 RegressionResponse* response) {
48 TRACELITERAL(
"TensorflowRegressionServiceImpl::RegressWithModelSpec");
50 ServableHandle<SavedModelBundle> saved_model_bundle;
51 TF_RETURN_IF_ERROR(core->GetServableHandle(model_spec, &saved_model_bundle));
52 return RunRegress(run_options, saved_model_bundle->meta_graph_def,
53 saved_model_bundle.id().version,
54 saved_model_bundle->session.get(), request, response,