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_LOCAL_EXECUTOR_PARAMS_H_ |
17 | #define TENSORFLOW_CORE_COMMON_RUNTIME_LOCAL_EXECUTOR_PARAMS_H_ |
18 | |
19 | #include <functional> |
20 | #include <memory> |
21 | |
22 | namespace tsl { |
23 | class Status; |
24 | } |
25 | namespace tensorflow { |
26 | class Device; |
27 | class StepStatsCollector; |
28 | class SessionMetadata; |
29 | class FunctionLibraryRuntime; |
30 | class NodeProperties; |
31 | class OpKernel; |
32 | using tsl::Status; |
33 | |
34 | // LocalExecutorParams provides arguments that will be shared by all invocations |
35 | // of an executor. We expect that different contexts would provide different |
36 | // implementations (e.g. local versus distributed). |
37 | struct LocalExecutorParams { |
38 | Device* device; |
39 | |
40 | const SessionMetadata* session_metadata = nullptr; |
41 | |
42 | // The library runtime support. |
43 | FunctionLibraryRuntime* function_library = nullptr; |
44 | |
45 | // create_kernel returns an instance of op kernel based on NodeDef. |
46 | // delete_kernel is called for every kernel used by the executor |
47 | // when the executor is deleted. |
48 | std::function<Status(const std::shared_ptr<const NodeProperties>&, |
49 | OpKernel**)> |
50 | create_kernel; |
51 | std::function<void(OpKernel*)> delete_kernel; |
52 | |
53 | // Whether control flow nodes are allowed to be executed synchronously. |
54 | bool allow_control_flow_sync_execution = false; |
55 | }; |
56 | |
57 | } // end namespace tensorflow |
58 | |
59 | #endif // TENSORFLOW_CORE_COMMON_RUNTIME_LOCAL_EXECUTOR_PARAMS_H_ |
60 | |