MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TFE_NewContext

Function TFE_NewContext

tensorflow/c/eager/c_api.cc:380–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

378void TFE_DeleteContextOptions(TFE_ContextOptions* options) { delete options; }
379
380TFE_Context* TFE_NewContext(const TFE_ContextOptions* opts, TF_Status* status) {
381 std::vector<std::unique_ptr<tensorflow::Device>> devices;
382 status->status = tensorflow::DeviceFactory::AddDevices(
383 opts->session_options.options, "/job:localhost/replica:0/task:0",
384 &devices);
385 if (!status->status.ok()) return nullptr;
386 std::unique_ptr<tensorflow::DeviceMgr> device_mgr(
387 new tensorflow::DeviceMgr(std::move(devices)));
388
389 tensorflow::Rendezvous* r =
390 new tensorflow::IntraProcessRendezvous(device_mgr.get());
391
392 return new TFE_Context(opts->session_options.options,
393 opts->device_placement_policy, opts->mirroring_policy,
394 opts->async, device_mgr.release(),
395 /*device_mgr_owned*/ true, r,
396 tensorflow::GetDefaultCustomKernelCreator());
397}
398
399TFE_Context* TFE_NewContextFromSession(const TFE_ContextOptions* opts,
400 TF_Session* sess, TF_Status* status) {

Callers 15

ConstantFoldFallbackHookFunction · 0.85
TESTFunction · 0.85
AddEagerOpToGraphTestMethod · 0.85
ShapeInferenceTestMethod · 0.85
BM_InitOpFunction · 0.85
BM_ExecuteFunction · 0.85
BM_Execute_IdentityFunction · 0.85
TESTFunction · 0.85
TestRemoteExecuteFunction · 0.85

Calls 4

okMethod · 0.45
getMethod · 0.45
releaseMethod · 0.45

Tested by 15

TESTFunction · 0.68
AddEagerOpToGraphTestMethod · 0.68
ShapeInferenceTestMethod · 0.68
BM_InitOpFunction · 0.68
BM_ExecuteFunction · 0.68
BM_Execute_IdentityFunction · 0.68
TESTFunction · 0.68
TestRemoteExecuteFunction · 0.68