tensorflow/core/tpu/graph_rewrite/combine_tpu_embedding_load_retrieve_pass.cc
// Validates that all of the table names are distinct and non-empty.
Validates that all of the table names are distinct and non-empty.
Validates that all of the table names are distinct and non - empty .
Status ValidateEmbeddingTableNames(
    const tensorflow::tpu::TPUEmbeddingConfiguration& tpu_embedding_config) {
  TableNameToIntegerMap table_name_map;
  for (int table_id = 0;
       table_id < tpu_embedding_config.table_descriptor_size(); ++table_id) {
    const auto& table = tpu_embedding_config.table_descriptor(table_id);
    const std::string& name = table.name();
    if (name.empty()) {
      return errors::InvalidArgument(
          absl::StrFormat("Table %d has empty name string.", table_id));
    }
    bool inserted = gtl::InsertIfNotPresent(&table_name_map, name, table_id);
    if (!inserted) {
      return errors::InvalidArgument(
          absl::StrFormat("Tables %d and %d have the same name '%s'.",
                          table_name_map[name], table_id, name.c_str()));
    }
  }
  return Status::OK();
}
Status ValidateEmbeddingTableNames ( const tensorflow :: tpu :: TPUEmbeddingConfiguration & tpu_embedding_config ) { TableNameToIntegerMap table_name_map ; for ( int table_id = 0 ; table_id < tpu_embedding_config . table_descriptor_size ( ) ; ++ table_id ) { const auto & table = tpu_embedding_config . table_descriptor ( table_id ) ; const std :: string & name = table . name ( ) ; if ( name . empty ( ) ) { return errors :: InvalidArgument ( absl :: StrFormat ( " " , table_id ) ) ; } bool inserted = gtl :: InsertIfNotPresent ( & table_name_map , name , table_id ) ; if ( ! inserted ) { return errors :: InvalidArgument ( absl :: StrFormat ( " " , table_name_map [ name ] , table_id , name . c_str ( ) ) ) ; } } return Status :: OK ( ) ; }
Validates that all of the table names are distinct and non-empty.
Validates that all of the table names are distinct and non - empty .
// Map from table names to first occurrences.