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

Function GetTableHandle

tensorflow/core/kernels/lookup_util.cc:254–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252};
253
254Status GetTableHandle(const string& input_name, OpKernelContext* ctx,
255 string* container, string* table_handle) {
256 {
257 mutex* mu;
258 TF_RETURN_IF_ERROR(ctx->input_ref_mutex(input_name, &mu));
259 mutex_lock l(*mu);
260 Tensor tensor;
261 TF_RETURN_IF_ERROR(ctx->mutable_input(input_name, &tensor, true));
262 if (tensor.NumElements() != 2) {
263 return errors::InvalidArgument(
264 "Lookup table handle must be scalar, but had shape: ",
265 tensor.shape().DebugString());
266 }
267 auto h = tensor.flat<tstring>();
268 *container = h(0);
269 *table_handle = h(1);
270 }
271 return Status::OK();
272}
273
274} // namespace
275

Callers 2

GetLookupTableFunction · 0.85

Calls 6

InvalidArgumentFunction · 0.85
input_ref_mutexMethod · 0.60
mutable_inputMethod · 0.45
NumElementsMethod · 0.45
DebugStringMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected