TensorFlow Serving C++ API Documentation
resource_estimator.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 #ifndef THIRD_PARTY_TENSORFLOW_SERVING_SERVABLES_TENSORFLOW_GOOGLE_RESOURCE_ESTIMATER_H_
17 #define THIRD_PARTY_TENSORFLOW_SERVING_SERVABLES_TENSORFLOW_GOOGLE_RESOURCE_ESTIMATER_H_
18 
19 #include "tensorflow_serving/resources/resources.pb.h"
20 #include "tensorflow_serving/util/file_probing_env.h"
21 
22 namespace tensorflow {
23 namespace serving {
24 
25 // Estimates the ram resources a session bundle or saved model bundle will use
26 // once loaded, from validation results. Currently, it returns UNIMPLEMENTED.
27 //
28 // TODO(b/150736159): Add support for using validation result.
29 Status EstimateMainRamBytesFromValidationResult(const string& path,
30  ResourceAllocation* estimate);
31 
32 // Estimates the ram resources a session bundle or saved model bundle will use
33 // once loaded, from its export or saved model path.
34 //
35 // TODO(b/150736159): Support use_validation_result. Right now,
36 // use_validation_result is ignored and the function always get resource
37 // estimation from disk.
38 Status EstimateMainRamBytesFromPath(const string& path,
39  bool use_validation_result,
40  FileProbingEnv* env,
41  ResourceAllocation* estimate);
42 
43 } // namespace serving
44 } // namespace tensorflow
45 
46 #endif // THIRD_PARTY_TENSORFLOW_SERVING_SERVABLES_TENSORFLOW_GOOGLE_RESOURCE_ESTIMATER_H_