1/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations 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
24namespace tensorflow {
25
26class AttrSlice;
27struct FunctionBody;
28class FunctionDef;
29class FunctionLibraryDefinition;
30class OpDef;
31
32// Instantiates FunctionDef into a graph. Set *fbody to point to the
33// FunctionBody that holds the instantiated FunctionDef.
34Status 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'.
41Status 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