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

Function GetInitializableLookupTable

tensorflow/core/kernels/lookup_util.cc:293–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291}
292
293Status GetInitializableLookupTable(const string& input_name,
294 OpKernelContext* ctx,
295 InitializableLookupTable** table) {
296 LookupInterface* lookup_table;
297 DataType handle_dtype;
298 TF_RETURN_IF_ERROR(ctx->input_dtype(input_name, &handle_dtype));
299 if (handle_dtype == DT_RESOURCE) {
300 ResourceHandle handle;
301 TF_RETURN_IF_ERROR(HandleFromInput(ctx, input_name, &handle));
302 TF_RETURN_IF_ERROR(LookupResource(ctx, handle, &lookup_table));
303 *table = lookup_table->GetInitializableLookupTable();
304 if (*table == nullptr) {
305 lookup_table->Unref();
306 return errors::InvalidArgument("Table ", handle.container(), " ",
307 handle.name(), " is not initializable");
308 }
309 } else {
310 string container;
311 string table_handle;
312 TF_RETURN_IF_ERROR(
313 GetTableHandle(input_name, ctx, &container, &table_handle));
314 TF_RETURN_IF_ERROR(ctx->resource_manager()->Lookup(container, table_handle,
315 &lookup_table));
316 *table = lookup_table->GetInitializableLookupTable();
317 if (*table == nullptr) {
318 lookup_table->Unref();
319 return errors::InvalidArgument("Table ", container, " ", table_handle,
320 " is not initializable");
321 }
322 }
323 return Status::OK();
324}
325
326Status CheckTableDataTypes(const LookupInterface& table, DataType key_dtype,
327 DataType value_dtype, const string& table_name) {

Callers 2

ComputeMethod · 0.85
ComputeMethod · 0.85

Calls 11

HandleFromInputFunction · 0.85
LookupResourceFunction · 0.85
InvalidArgumentFunction · 0.85
GetTableHandleFunction · 0.85
nameMethod · 0.65
input_dtypeMethod · 0.45
UnrefMethod · 0.45
containerMethod · 0.45
LookupMethod · 0.45
resource_managerMethod · 0.45

Tested by

no test coverage detected