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

Method FunctionLibraryRuntimeImpl

tensorflow/core/common_runtime/function.cc:445–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

443};
444
445FunctionLibraryRuntimeImpl::FunctionLibraryRuntimeImpl(
446 const DeviceMgr* dmgr, Env* env, Device* device, int graph_def_version,
447 const FunctionLibraryDefinition* lib_def,
448 thread::ThreadPool* default_thread_pool,
449 const OptimizerOptions& optimizer_options,
450 const CustomKernelCreator* custom_kernel_creator,
451 const SessionMetadata* session_metadata,
452 ProcessFunctionLibraryRuntime* parent)
453 : device_mgr_(dmgr),
454 device_(device),
455 env_(env),
456 graph_def_version_(graph_def_version),
457 base_lib_def_(lib_def),
458 optimizer_(optimizer_options),
459 custom_kernel_creator_(custom_kernel_creator),
460 session_metadata_(session_metadata),
461 default_runner_(nullptr),
462 default_cost_runner_(nullptr),
463 device_name_(device_ == nullptr
464 ? ProcessFunctionLibraryRuntime::kDefaultFLRDevice
465 : device_->name()),
466 next_handle_(0),
467 items_(new std::unordered_map<Handle, std::unique_ptr<Item>>),
468 parent_(parent) {
469 get_func_sig_ = [this](const string& op, const OpDef** sig) {
470 return base_lib_def_->LookUpOpDef(op, sig);
471 };
472 create_kernel_ = [this](const NodeDef& ndef, OpKernel** kernel) {
473 return CreateKernel(ndef, kernel);
474 };
475 thread::ThreadPool* pool = nullptr;
476 if (device_ != nullptr) {
477 pool = device_->tensorflow_device_thread_pool();
478 }
479 if (pool == nullptr) {
480 pool = default_thread_pool;
481 }
482 if (pool != nullptr) {
483 default_runner_ = [pool](Executor::Args::Closure c) {
484 pool->Schedule(std::move(c));
485 };
486 default_cost_runner_ = [pool](Executor::Args::Closure c, int64 cost) {
487 if (cost < 1) {
488 pool->Schedule(std::move(c));
489 } else {
490 pool->CostSchedule(std::move(c), cost);
491 }
492 };
493 }
494}
495
496FunctionLibraryRuntimeImpl::~FunctionLibraryRuntimeImpl() {
497 // Deleting the items_ list will delete all the function handles registered in

Callers

nothing calls this directly

Calls 6

LookUpOpDefMethod · 0.80
CostScheduleMethod · 0.80
nameMethod · 0.65
CreateKernelFunction · 0.50
ScheduleMethod · 0.45

Tested by

no test coverage detected