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

Method Add

tensorflow/core/common_runtime/eager/eager_executor.cc:96–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96Status EagerExecutor::Add(std::unique_ptr<EagerNode> node) {
97 Status status;
98
99 // If we are unable to add the node to the queue, we must call Abort. However,
100 // we want to do that outside of the scope of the lock since the Abort may
101 // try to call EagerExecutor::Add()
102 {
103 tensorflow::mutex_lock l(node_queue_mutex_);
104 if (state_ != ExecutorState::kActive) {
105 status = errors::FailedPrecondition(
106 "EagerExecutor accepts new EagerNodes to run only in Active state. "
107 "Current state is '",
108 StateStringLocked(), "'");
109 } else {
110 DCHECK(thread_) << "EnableAsync should have been called before Add";
111 status = status_;
112 if (status.ok()) {
113 node_queue_.push(std::move(node));
114
115 // If there were no previous nodes pending, wake the run thread to start
116 // processing requests again.
117 if (node_queue_.size() == 1) {
118 nodes_pending_.notify_all();
119 }
120
121 return Status::OK();
122 }
123 }
124 }
125
126 // Node needs to be aborted since it was not added to the queue
127 node->Abort(status);
128 return status;
129}
130
131tensorflow::Status EagerExecutor::WaitForAllPendingNodes() {
132 tensorflow::mutex_lock l(node_queue_mutex_);

Callers 11

RunInternalMethod · 0.45
RecordGraphInputTensorsFunction · 0.45
RecordGraphOutputTensorsFunction · 0.45
UpdateGraphExecTimeFunction · 0.45
SetMemoryMethod · 0.45
ExtendMethod · 0.45
UpdateStatsFunction · 0.45
EagerLocalExecuteFunction · 0.45
EagerRemoteExecuteFunction · 0.45
LocalEagerCopyToDeviceFunction · 0.45
EagerCopyToDeviceFunction · 0.45

Calls 6

FailedPreconditionFunction · 0.85
notify_allMethod · 0.80
okMethod · 0.45
pushMethod · 0.45
sizeMethod · 0.45
AbortMethod · 0.45

Tested by

no test coverage detected