tensorflow/compiler/mlir/quantization/tensorflow/utils/lift_as_function_call_utils.cc
// Inserts the function to the symbol table of the module thread-safely.
Inserts the function to the symbol table of the module thread-safely.
Inserts the function to the symbol table of the module thread - safely .
StringAttr InsertToSymbolTable(Operation *module, Operation *function,
                               const std::string &func_name) {
  static tensorflow::mutex *mtx = new tensorflow::mutex();
  tensorflow::mutex_lock lock(*mtx);
  SymbolTable symbol_table(module);
  std::string unique_name = func_name;
  int32_t uniquing_counter = 0;
  while (symbol_table.lookup(unique_name) != nullptr) {
    ++uniquing_counter;
    unique_name = func_name + "_" + std::to_string(uniquing_counter);
  }
  function->setAttr("sym_name",
                    StringAttr::get(module->getContext(), unique_name));
  return symbol_table.insert(function);
}
StringAttr InsertToSymbolTable ( Operation * module , Operation * function , const std :: string & func_name ) { static tensorflow :: mutex * mtx = new tensorflow :: mutex ( ) ; tensorflow :: mutex_lock lock ( * mtx ) ; SymbolTable symbol_table ( module ) ; std :: string unique_name = func_name ; int32_t uniquing_counter = 0 ; while ( symbol_table . lookup ( unique_name ) != nullptr ) { ++ uniquing_counter ; unique_name = func_name + " " + std :: to_string ( uniquing_counter ) ; } function -> setAttr ( " " , StringAttr :: get ( module -> getContext ( ) , unique_name ) ) ; return symbol_table . insert ( function ) ; }
Inserts the function to the symbol table of the module thread-safely.
Inserts the function to the symbol table of the module thread - safely .