| 74 | "/job:localhost/replica:0/task:0")) {} |
| 75 | |
| 76 | void Create(const FunctionDef& fdef, test::function::Attrs attrs) { |
| 77 | exec_ = nullptr; |
| 78 | InstantiationResult result; |
| 79 | TF_CHECK_OK(InstantiateFunction(fdef, attrs, GetOpSig, &result)); |
| 80 | |
| 81 | arg_types_ = result.arg_types; |
| 82 | ret_types_ = result.ret_types; |
| 83 | |
| 84 | std::unique_ptr<Graph> g(new Graph(OpRegistry::Global())); |
| 85 | GraphConstructorOptions opts; |
| 86 | opts.allow_internal_ops = true; |
| 87 | opts.expect_device_spec = false; |
| 88 | TF_CHECK_OK(ConvertNodeDefsToGraph(opts, result.nodes, g.get())); |
| 89 | |
| 90 | const int version = g->versions().producer(); |
| 91 | LocalExecutorParams params; |
| 92 | params.device = device_.get(); |
| 93 | params.create_kernel = [this, version](const NodeDef& ndef, |
| 94 | OpKernel** kernel) { |
| 95 | return CreateNonCachedKernel(device_.get(), nullptr, ndef, version, |
| 96 | kernel); |
| 97 | }; |
| 98 | params.delete_kernel = [](OpKernel* kernel) { |
| 99 | DeleteNonCachedKernel(kernel); |
| 100 | }; |
| 101 | params.rendezvous_factory = [](const int64, const DeviceMgr* device_mgr, |
| 102 | Rendezvous** r) { |
| 103 | *r = new IntraProcessRendezvous(device_mgr); |
| 104 | return Status::OK(); |
| 105 | }; |
| 106 | Executor* exec; |
| 107 | TF_CHECK_OK(NewLocalExecutor(params, std::move(g), &exec)); |
| 108 | exec_.reset(exec); |
| 109 | } |
| 110 | |
| 111 | void Run(const std::vector<Tensor>& args, std::vector<Tensor*> rets) { |
| 112 | FunctionCallFrame frame(arg_types_, ret_types_); |
nothing calls this directly
no test coverage detected