1 /* Copyright 2015 The TensorFlow Authors. 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 TENSORFLOW_CORE_COMMON_RUNTIME_FUNCTION_DEF_UTILS_H_
17 #define TENSORFLOW_CORE_COMMON_RUNTIME_FUNCTION_DEF_UTILS_H_
18 
19 #include <functional>
20 #include <memory>
21 
22 #include "tensorflow/core/lib/core/status.h"
23 
24 namespace tensorflow {
25 
26 class AttrSlice;
27 struct FunctionBody;
28 class FunctionDef;
29 class FunctionLibraryDefinition;
30 class OpDef;
31 
32 // Instantiates FunctionDef into a graph. Set *fbody to point to the
33 // FunctionBody that holds the instantiated FunctionDef.
34 Status FunctionDefToBodyHelper(const FunctionDef& fdef, const AttrSlice& attrs,
35                                const FunctionLibraryDefinition* lib_def,
36                                std::unique_ptr<FunctionBody>* fbody);
37 
38 // Instantiates FunctionDef into a graph. Set *fbody to point to the
39 // FunctionBody that holds the instantiated FunctionDef. Use custom function
40 // signature lookup, in case instantiated function is not in the 'lib_def'.
41 Status FunctionDefToBodyHelper(
42     const FunctionDef& fdef, const AttrSlice& attrs,
43     const FunctionLibraryDefinition* lib_def,
44     const std::function<Status(const string&, const OpDef**)>& get_func_sig,
45     std::unique_ptr<FunctionBody>* fbody);
46 
47 }  // end namespace tensorflow
48 
49 #endif  // TENSORFLOW_CORE_COMMON_RUNTIME_FUNCTION_DEF_UTILS_H_
50