class_docstr: Returns random values from a categorical distribution.
  
  Parameters
  ----------
  x: <\*D_in, T>
      * N-dimensional tensor which represents ``logits`` (event log-probabilities) or ``probs``
        (event probabilities) depending on ``mode``. The first ``N - 1`` dimensions specifies
        distributions, and the last dimension represents a vector of probabilities.
  
  mode: const<str> (Optional)
      One of ``['logits', 'probs']``. Defaults to ``logits``.
      When set to ``probs``, an element-wise log layer will be added to calculate logits.
  
  size: const<i32> (Optional)
      Number of samples to draw. Defaults to ``1``.
      When set as ``1``, it's categorical distribution.
      When set larger than ``1``, it's actually multinomial distribution by drawing with
      replacement. It means that when a sample index is drawn, it can be drawn again.
      The categorical distribution is a special case of the multinomial distribution, giving
      the probabilities of potential outcomes of a single drawing rather than multiple drawings.
  
  seed: const<i32> (Optional)
      Seed to create a reproducible sequence of values across multiple invokes.
  
  Returns
  -------
  <\*D_in[:-1] + [size], T>
      * A tensor of the given target output shape filled with random values.
  
  Attributes
  ----------
  T: fp16, fp32
  
  See Also
  --------
  random_bernoulli, random_normal, random_uniform
class_docstr_tok: ["Returns","random","values","from","a","categorical","distribution",".","Parameters","--","--","--","--","--","x",":","<","\\","*","D_in",",","T",">","*","N-dimensional","tensor","which","represents","``","logits","``","(","event","log-probabilities",")","or","``","probs","``","(","event","probabilities",")","depending","on","``","mode","``",".","The","first","``","N","-","1","``","dimensions","specifies","distributions",",","and","the","last","dimension","represents","a","vector","of","probabilities",".","mode",":","const","<","str",">","(","Optional",")","One","of","``","[","'logits","'",",","'probs","'","]","``",".","Defaults","to","``","logits","``",".","When","set","to","``","probs","``",",","an","element-wise","log","layer","will","be","added","to","calculate","logits",".","size",":","const","<","i32",">","(","Optional",")","Number","of","samples","to","draw",".","Defaults","to","``","1","``",".","When","set","as","``","1","``",",","it","'s","categorical","distribution",".","When","set","larger","than","``","1","``",",","it","'s","actually","multinomial","distribution","by","drawing","with","replacement",".","It","means","that","when","a","sample","index","is","drawn",",","it","can","be","drawn","again",".","The","categorical","distribution","is","a","special","case","of","the","multinomial","distribution",",","giving","the","probabilities","of","potential","outcomes","of","a","single","drawing","rather","than","multiple","drawings",".","seed",":","const","<","i32",">","(","Optional",")","Seed","to","create","a","reproducible","sequence","of","values","across","multiple","invokes",".","Returns","--","--","--","-","<","\\","*","D_in","[",":","-1","]","+","[","size","]",",","T",">","*","A","tensor","of","the","given","target","output","shape","filled","with","random","values",".","Attributes","--","--","--","--","--","T",":","fp16",",","fp32","See","Also","--","--","--","--","random_bernoulli",",","random_normal",",","random_uniform"]
code: def type_inference(self):
      self.out_dtype = self.x.dtype
      output_shape = self.x.shape[:-1] + (self.size.val,)
      return types.tensor(self.out_dtype, output_shape)
  
imports: from coremltools.converters.mil.mil import get_new_symbol, get_new_variadic_symbol, types
  from coremltools.converters.mil.mil.input_type import DefaultInputs, InputSpec, TensorInputType
  from coremltools.converters.mil.mil.operation import Operation
  from coremltools.converters.mil.mil.ops.defs._op_reqs import register_op
  from coremltools.converters.mil.mil.types.symbolic import any_symbolic
label_desc: Use image node_id 2 for calling the random_categorical obj's underlying member method code with example usage: obj.type_inference() and returns: types