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_LOCAL_EXECUTOR_PARAMS_H_
17#define TENSORFLOW_CORE_COMMON_RUNTIME_LOCAL_EXECUTOR_PARAMS_H_
18
19#include <functional>
20#include <memory>
21
22namespace tsl {
23class Status;
24}
25namespace tensorflow {
26class Device;
27class StepStatsCollector;
28class SessionMetadata;
29class FunctionLibraryRuntime;
30class NodeProperties;
31class OpKernel;
32using 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).
37struct 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