class_docstr: Computes the similarity graph from a set of (dense) embeddings.
docstr: Initializes this GraphBuilder from the given configuration instance.
  
  Args:
    graph_builder_config: A `nsl.configs.GraphBuilderConfig` instance.
  
  Raises:
    ValueError: If `lsh_splits < 0` or if `lsh_splits > 0 and lsh_rounds < 1`.
docstr_tok: ["Initializes","this","GraphBuilder","from","the","given","configuration","instance",".","Args",":","graph_builder_config",":","A","`","nsl.configs.GraphBuilderConfig","`","instance",".","Raises",":","ValueError",":","If","`","lsh_splits","<","0","`","or","if","`","lsh_splits",">","0","and","lsh_rounds","<","1","`","."]
code: def __init__(self, graph_builder_config):
      """Initializes this GraphBuilder from the given configuration instance.
  
      Args:
        graph_builder_config: A `nsl.configs.GraphBuilderConfig` instance.
  
      Raises:
        ValueError: If `lsh_splits < 0` or if `lsh_splits > 0 and lsh_rounds < 1`.
      """
      self.config = graph_builder_config
      if self.config.lsh_splits < 0:
          raise ValueError("lsh_splits < 0")
      if self.config.lsh_splits > 0 and self.config.lsh_rounds < 1:
          raise ValueError("lsh_splits > 0 but lsh_rounds < 1")
  
      # Keep a set of previously written edges if it's possible we might
      # generate the same edge multiple times. This can happen only if both
      # 'lsh_splits > 0' and 'lsh_rounds > 1'. To save space, we pick a canonical
      # ordering (source < target) for each bi-directional edge. Note that we
      # do not need to store the edge weight as well because for any
      # (source, target) pair, the cosine similarity between them will never
      # change.
      self.edge_set = None
      if self.config.lsh_splits > 0 and self.config.lsh_rounds > 1:
          self.edge_set = set()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import itertools
  import time
  from absl import app
  from absl import flags
  from absl import logging
  import neural_structured_learning.configs
  import numpy
  import six
  import tensorflow
label_desc: Use image node_id 1 to create a new GraphBuilder object from inherited base classes: object with example: obj = GraphBuilder(graph_builder_config)