class_docstr: Base implementation of unsupervised GraphSAGE
class_docstr_tok: ["Base","implementation","of","unsupervised","GraphSAGE"]
docstr: Sample neighbors to be the supportive fields for multi-layer convolutions.
  
  Args:
      inputs: batch inputs
      batch_size: the number of inputs (different for batch inputs and negative samples).
docstr_tok: ["Sample","neighbors","to","be","the","supportive","fields","for","multi-layer","convolutions",".","Args",":","inputs",":","batch","inputs","batch_size",":","the","number","of","inputs","(","different","for","batch","inputs","and","negative","samples",")","."]
code: def sample(self, inputs, layer_infos, batch_size=None):
      """Sample neighbors to be the supportive fields for multi-layer convolutions.
  
      Args:
          inputs: batch inputs
          batch_size: the number of inputs (different for batch inputs and negative samples).
      """
  
      if batch_size is None:
          batch_size = self.batch_size
      samples = [inputs]
      # size of convolution support at each layer per node
      support_size = 1
      support_sizes = [support_size]
      for k in range(len(layer_infos)):
          t = len(layer_infos) - k - 1
          support_size *= layer_infos[t].num_samples
          sampler = layer_infos[t].neigh_sampler
          node = sampler((samples[k], layer_infos[t].num_samples))
          samples.append(
              tf.reshape(
                  node,
                  [
                      support_size * batch_size,
                  ],
              )
          )
          support_sizes.append(support_size)
      return samples, support_sizes
  
imports: from collections import namedtuple
  import tensorflow
  import math
  import graphsage.layers
  import graphsage.metrics
  from .prediction import BipartiteEdgePredLayer
  from .aggregators import MeanAggregator, MaxPoolingAggregator, MeanPoolingAggregator, SeqAggregator, GCNAggregator
label_desc: Use image node_id 2 for calling the SampleAndAggregate obj's underlying member method code with example usage: obj.sample(inputs, layer_infos, batch_size) and returns: samples,  support_sizes