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

Method AddFunctionDef

tensorflow/core/common_runtime/eager/context.cc:413–435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

411}
412
413Status EagerContext::AddFunctionDef(const FunctionDef& fdef) {
414 bool is_first_ref = false;
415 {
416 mutex_lock l(cache_mu_);
417 auto* registered_function =
418 gtl::FindPtrOrNull(registered_functions_, fdef.signature().name());
419 if (registered_function == nullptr) {
420 registered_function = new RegisteredFunction;
421 registered_function->cached_kernel_keys =
422 absl::make_unique<std::vector<Fprint128>>();
423 gtl::InsertOrUpdate(&registered_functions_, fdef.signature().name(),
424 registered_function);
425 } else {
426 registered_function->Ref();
427 }
428 is_first_ref = registered_function->RefCountIsOne();
429 }
430 if (is_first_ref) {
431 TF_RETURN_IF_ERROR(func_lib_def_.AddFunctionDef(fdef));
432 return MaybeRegisterFunctionRemotely(fdef);
433 }
434 return Status::OK();
435}
436
437Status EagerContext::RemoveFunction(const string& func) {
438 bool is_last_ref = false;

Callers 4

RunMethod · 0.45
OptimizeGraphMethod · 0.45
TESTFunction · 0.45

Calls 6

FindPtrOrNullFunction · 0.85
InsertOrUpdateFunction · 0.85
signatureMethod · 0.80
nameMethod · 0.65
RefMethod · 0.45
RefCountIsOneMethod · 0.45

Tested by 2

RunMethod · 0.36
TESTFunction · 0.36