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

Function GetStack

tensorflow/core/kernels/stack.cc:127–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125};
126
127Status GetStack(OpKernelContext* ctx, Stack** stack) {
128 if (ctx->input_dtype(0) == DT_RESOURCE) {
129 return LookupResource(ctx, HandleFromInput(ctx, 0), stack);
130 } else {
131 Tensor Tstack_handle = ctx->mutable_input(0, false);
132 if (Tstack_handle.NumElements() != 2) {
133 return errors::InvalidArgument(
134 "Stack handle must have two elements, but had shape: ",
135 Tstack_handle.shape().DebugString());
136 }
137 const string& container = Tstack_handle.flat<tstring>()(0);
138 const string& stack_name = Tstack_handle.flat<tstring>()(1);
139 string key = strings::StrCat(container, stack_name);
140 ResourceMgr* rm = ctx->resource_manager();
141 if (rm == nullptr) {
142 return errors::Internal("No resource manager.");
143 }
144 auto* step_container = ctx->step_container();
145 if (step_container == nullptr) {
146 return errors::Internal("No step container.");
147 }
148 //TF_RETURN_IF_ERROR(rm->Lookup(step_container->name(), key, stack));
149 TF_RETURN_IF_ERROR(step_container->Lookup(rm, key, stack));
150 return Status::OK();
151 }
152}
153
154std::atomic<int64> Stack::stack_counter{0};
155

Callers 2

ComputeAsyncMethod · 0.85
ComputeMethod · 0.85

Calls 13

LookupResourceFunction · 0.85
HandleFromInputFunction · 0.85
InvalidArgumentFunction · 0.85
InternalFunction · 0.85
step_containerMethod · 0.80
StrCatFunction · 0.50
input_dtypeMethod · 0.45
mutable_inputMethod · 0.45
NumElementsMethod · 0.45
DebugStringMethod · 0.45
shapeMethod · 0.45
resource_managerMethod · 0.45

Tested by

no test coverage detected