class_docstr: Module component with similar interface to numpy.random
  (numpy.random.RandomState).
  
  Parameters
  ----------
  seed : int or list of 6 int
      A default seed to initialize the random state.
      If a single int is given, it will be replicated 6 times.
      The first 3 values of the seed must all be less than M1 = 2147483647,
      and not all 0; and the last 3 values must all be less than
      M2 = 2147462579, and not all 0.
docstr: Sample `size` times from a multinomial distribution defined by
  probabilities `p`, and returns the indices of the sampled elements.
  Sampled values are between 0 and `p.shape[1]-1`.
  Only sampling without replacement is implemented for now.
  
  Parameters
  ----------
  size: integer or integer tensor (default 1)
      The number of samples. It should be between 1 and `p.shape[1]-1`.
  a: int or None (default None)
      For now, a should be None. This function will sample
      values between 0 and `p.shape[1]-1`. When a != None will be
      implemented, if `a` is a scalar, the samples are drawn from the
      range 0,...,a-1. We default to 2 as to have the same interface as
      RandomStream.
  replace: bool (default True)
      Whether the sample is with or without replacement.
      Only replace=False is implemented for now.
  p: 2d numpy array or theano tensor
      the probabilities of the distribution, corresponding to values
      0 to `p.shape[1]-1`.
  
  Example : p = [[.98, .01, .01], [.01, .49, .50]] and size=1 will
  probably result in [[0],[2]]. When setting size=2, this
  will probably result in [[0,1],[2,1]].
  
  Notes
  -----
  -`ndim` is only there keep the same signature as other
  uniform, binomial, normal, etc.
  
  -Does not do any value checking on pvals, i.e. there is no
  check that the elements are non-negative, less than 1, or
  sum to 1. passing pvals = [[-2., 2.]] will result in
  sampling [[0, 0]]
  
  -Only replace=False is implemented for now.
docstr_tok: ["Sample","`","size","`","times","from","a","multinomial","distribution","defined","by","probabilities","`","p","`",",","and","returns","the","indices","of","the","sampled","elements",".","Sampled","values","are","between","0","and","`","p.shape","[","1","]","-1","`",".","Only","sampling","without","replacement","is","implemented","for","now",".","Parameters","--","--","--","--","--","size",":","integer","or","integer","tensor","(","default","1",")","The","number","of","samples",".","It","should","be","between","1","and","`","p.shape","[","1","]","-1","`",".","a",":","int","or","None","(","default","None",")","For","now",",","a","should","be","None",".","This","function","will","sample","values","between","0","and","`","p.shape","[","1","]","-1","`",".","When","a","!","=","None","will","be","implemented",",","if","`","a","`","is","a","scalar",",","the","samples","are","drawn","from","the","range","0",",","...",",","a-1",".","We","default","to","2","as","to","have","the","same","interface","as","RandomStream",".","replace",":","bool","(","default","True",")","Whether","the","sample","is","with","or","without","replacement",".","Only","replace=False","is","implemented","for","now",".","p",":","2d","numpy","array","or","theano","tensor","the","probabilities","of","the","distribution",",","corresponding","to","values","0","to","`","p.shape","[","1","]","-1","`",".","Example",":","p","=","[","[",".98",",",".01",",",".01","]",",","[",".01",",",".49",",",".50","]","]","and","size=1","will","probably","result","in","[","[","0","]",",","[","2","]","]",".","When","setting","size=2",",","this","will","probably","result","in","[","[","0,1","]",",","[","2,1","]","]",".","Notes","--","--","-","-","`","ndim","`","is","only","there","keep","the","same","signature","as","other","uniform",",","binomial",",","normal",",","etc",".","-Does","not","do","any","value","checking","on","pvals",",","i.e",".","there","is","no","check","that","the","elements","are","non-negative",",","less","than","1",",","or","sum","to","1.","passing","pvals","=","[","[","-2.",",","2",".","]","]","will","result","in","sampling","[","[","0",",","0","]","]","-Only","replace=False","is","implemented","for","now","."]
code: def choice(
      self,
      size=1,
      a=None,
      replace=True,
      p=None,
      ndim=None,
      dtype="int64",
      nstreams=None,
      **kwargs,
  ):
      """
      Sample `size` times from a multinomial distribution defined by
      probabilities `p`, and returns the indices of the sampled elements.
      Sampled values are between 0 and `p.shape[1]-1`.
      Only sampling without replacement is implemented for now.
  
      Parameters
      ----------
      size: integer or integer tensor (default 1)
          The number of samples. It should be between 1 and `p.shape[1]-1`.
      a: int or None (default None)
          For now, a should be None. This function will sample
          values between 0 and `p.shape[1]-1`. When a != None will be
          implemented, if `a` is a scalar, the samples are drawn from the
          range 0,...,a-1. We default to 2 as to have the same interface as
          RandomStream.
      replace: bool (default True)
          Whether the sample is with or without replacement.
          Only replace=False is implemented for now.
      p: 2d numpy array or theano tensor
          the probabilities of the distribution, corresponding to values
          0 to `p.shape[1]-1`.
  
      Example : p = [[.98, .01, .01], [.01, .49, .50]] and size=1 will
      probably result in [[0],[2]]. When setting size=2, this
      will probably result in [[0,1],[2,1]].
  
      Notes
      -----
      -`ndim` is only there keep the same signature as other
      uniform, binomial, normal, etc.
  
      -Does not do any value checking on pvals, i.e. there is no
      check that the elements are non-negative, less than 1, or
      sum to 1. passing pvals = [[-2., 2.]] will result in
      sampling [[0, 0]]
  
      -Only replace=False is implemented for now.
  
      """
      if replace:
          raise NotImplementedError(
              "MRG_RandomStreams.choice only works without replacement "
              "for now."
          )
  
      if a is not None:
          raise TypeError(
              "For now, a has to be None in "
              "MRG_RandomStreams.choice. Sampled values are "
              "between 0 and p.shape[1]-1"
          )
  
      if p is None:
          raise TypeError(
              "For now, p has to be specified in "
              "MRG_RandomStreams.choice."
          )
      p = as_tensor_variable(p)
      p = undefined_grad(p)
  
      if ndim is not None:
          raise ValueError(
              "ndim argument to "
              "MRG_RandomStreams.choice "
              "is not used."
          )
  
      if p.ndim != 2:
          raise NotImplementedError(
              "MRG_RandomStreams.choice is only implemented for p.ndim = 2"
          )
  
      shape = p[:, 0].shape * size
      unis = self.uniform(
          size=shape, ndim=1, nstreams=nstreams, **kwargs
      )
      op = multinomial.ChoiceFromUniform(odtype=dtype)
      return op(p, unis, as_tensor_variable(size))
  
imports: from __future__ import absolute_import, print_function, division
  import warnings
  import numpy
  from six import integer_types, string_types
  from six.moves import xrange
  import theano
  from theano import Op, Apply, shared, config, Variable
  from theano import gradient, function
  from theano.gradient import undefined_grad
  from theano import tensor
  from theano.tensor import TensorType, as_tensor_variable, get_vector_length, cast, opt, scal
  from theano.compile import optdb
  from theano.gof import local_optimizer, ParamsType
  from theano.scalar import bool, int32
  from .None import multinomial
label_desc: Use image node_id 12 for calling the MRG_RandomStreams obj's underlying member method code with example usage: obj.choice(size, a, replace, p, ndim, dtype, nstreams) and returns: op