docstr: Samples using the supplied sampler and inputs.
  
  Args:
    logits: Numpy ndarray of shape [batch_size, num_classes].
    num_samples: Int; number of samples to draw.
    sampler: A sampler function that takes (1) a [batch_size, num_classes]
      Tensor, (2) num_samples and returns a [batch_size, num_samples] Tensor.
  
  Returns:
    Frequencies from sampled classes; shape [batch_size, num_classes].
code: def _do_sampling(self, logits, num_samples, sampler):
      """Samples using the supplied sampler and inputs.
  
      Args:
        logits: Numpy ndarray of shape [batch_size, num_classes].
        num_samples: Int; number of samples to draw.
        sampler: A sampler function that takes (1) a [batch_size, num_classes]
          Tensor, (2) num_samples and returns a [batch_size, num_samples] Tensor.
  
      Returns:
        Frequencies from sampled classes; shape [batch_size, num_classes].
      """
      with test_util.use_gpu():
          random_seed.set_random_seed(1618)
          op = sampler(constant_op.constant(logits), num_samples)
          d = self.evaluate(op)
  
      batch_size, num_classes = logits.shape
      freqs_mat = []
      for i in range(batch_size):
          cnts = dict(collections.Counter(d[i, :]))
  
          # Requires drawn class labels be in range.
          self.assertLess(max(cnts.keys()), num_classes)
          self.assertGreaterEqual(min(cnts.keys()), 0)
  
          freqs = [
              (cnts[k] * 1.0 / num_samples if k in cnts else 0)
              for k in range(num_classes)
          ]
          freqs_mat.append(freqs)
  
      return freqs_mat
  
imports: import collections
  import timeit
  import numpy
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.python.client import session
  from tensorflow.python.eager import context
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import random_seed
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 12 for calling the MultinomialTest obj's underlying member method code with example usage: obj._do_sampling(logits, num_samples, sampler) and returns: freqs_mat