class_docstr: Gather slices from input ``x`` along dimension ``axis`` according to ``indices``,
  similar to `tf.gather <https://www.tensorflow.org/api_docs/python/tf/gather>`_.
  
  * If ``indices`` is scalar (0-D):
  
  .. math::
     output[p_0, ..., p_{axis-1}, ~~~~~~~~~~~~~~~~~~~~~~~~ p_{axis+1}, ..., p_{rank(x)-1}] =
  .. math::
     x[p_0, ..., p_{axis-1}, ~~~~~~~~~ indices, ~~~~~~~~ p_{axis+1}, ..., p_{rank(x)-1}]
  
  Where ``rank(x)`` is the rank of ``x``. The ``output`` has rank ``rank(x) - 1``.
  
  * If ``indices`` is 1-D tensor:
  
  .. math::
     output[p_0, ..., p_{axis-1}, ~~~~~~~~~~~~~ i, ~~~~~~~~~~~~~ p_{axis+1}, ..., p_{rank(*D)-1}] =
  .. math::
     x[p_0, ..., p_{axis-1}, ~~~~~~~~ indices[i], ~~~~~~~~ p_{axis+1}, ..., p_{rank(*D)-1}]
  
  The output has rank ``rank(x)``.
  
  * In general:
  
  .. math::
     output[p_0, ..., p_{axis-1}, ~~~~~~~~ i_0, ..., i_{M-1}, ~~~~~~~~ p_{axis+1}, ..., p_{rank(x)-1}] =
  .. math::
     x[p_0, ..., p_{axis-1}, ~~~~~~~ indices[i_0, ..., i_{M-1}], ~~~~~~~ p_{axis+1}, ..., p_{rank(x)-1}]
  
  Where ``M = rank(indices)``.
  
  Parameters
  ----------
  x: tensor<\*D, T> (Required)
  indices: tensor<\*N, i32> (Required)
      * Indices values may be negative. More precisely, ``-D[axis]<= v < D[axis]`` for ``v`` in ``indices``.
  axis: const i32 (Optional. Default=``0``)
      * Negative axis is supported.
  
  Returns
  -------
  tensor<\*K, T>
      * Where ``K = D[:axis] + N + D[axis+1:]``.
  
  Attributes
  ----------
  T: fp16, fp32, i32
  
  References
  ----------
  See `tf.gather <https://www.tensorflow.org/api_docs/python/tf/gather>`_.
class_docstr_tok: ["Gather","slices","from","input","``","x","``","along","dimension","``","axis","``","according","to","``","indices","``",",","similar","to","`","tf.gather","<","https",":","\/\/www.tensorflow.org\/api_docs\/python\/tf\/gather",">","`","_",".","*","If","``","indices","``","is","scalar","(","0-D",")",":","..","math",":",":","output","[","p_0",",","...",",","p_","{","axis-1","}",",","~~~~~~~~~~~~~~~~~~~~~~~~","p_","{","axis+1","}",",","...",",","p_","{","rank","(","x",")","-1","}","]","=","..","math",":",":","x","[","p_0",",","...",",","p_","{","axis-1","}",",","~~~~~~~~~","indices",",","~~~~~~~~","p_","{","axis+1","}",",","...",",","p_","{","rank","(","x",")","-1","}","]","Where","``","rank","(","x",")","``","is","the","rank","of","``","x","``",".","The","``","output","``","has","rank","``","rank","(","x",")","-","1","``",".","*","If","``","indices","``","is","1-D","tensor",":","..","math",":",":","output","[","p_0",",","...",",","p_","{","axis-1","}",",","~~~~~~~~~~~~~","i",",","~~~~~~~~~~~~~","p_","{","axis+1","}",",","...",",","p_","{","rank","(","*","D",")","-1","}","]","=","..","math",":",":","x","[","p_0",",","...",",","p_","{","axis-1","}",",","~~~~~~~~","indices","[","i","]",",","~~~~~~~~","p_","{","axis+1","}",",","...",",","p_","{","rank","(","*","D",")","-1","}","]","The","output","has","rank","``","rank","(","x",")","``",".","*","In","general",":","..","math",":",":","output","[","p_0",",","...",",","p_","{","axis-1","}",",","~~~~~~~~","i_0",",","...",",","i_","{","M-1","}",",","~~~~~~~~","p_","{","axis+1","}",",","...",",","p_","{","rank","(","x",")","-1","}","]","=","..","math",":",":","x","[","p_0",",","...",",","p_","{","axis-1","}",",","~~~~~~~","indices","[","i_0",",","...",",","i_","{","M-1","}","]",",","~~~~~~~","p_","{","axis+1","}",",","...",",","p_","{","rank","(","x",")","-1","}","]","Where","``","M","=","rank","(","indices",")","``",".","Parameters","--","--","--","--","--","x",":","tensor","<","\\","*","D",",","T",">","(","Required",")","indices",":","tensor","<","\\","*","N",",","i32",">","(","Required",")","*","Indices","values","may","be","negative",".","More","precisely",",","``","-D","[","axis","]","<","=","v","<","D","[","axis","]","``","for","``","v","``","in","``","indices","``",".","axis",":","const","i32","(","Optional",".","Default=","``","0","``",")","*","Negative","axis","is","supported",".","Returns","--","--","--","-","tensor","<","\\","*","K",",","T",">","*","Where","``","K","=","D","[",":","axis","]","+","N","+","D","[","axis+1",":","]","``",".","Attributes","--","--","--","--","--","T",":","fp16",",","fp32",",","i32","References","--","--","--","--","--","See","`","tf.gather","<","https",":","\/\/www.tensorflow.org\/api_docs\/python\/tf\/gather",">","`","_","."]
code: def value_inference(self):
      x = self.x.sym_val
      indices = self.indices.val
      if indices is None:
          # only allow x to be symbolic. indices cannot.
          return None
      return compute_gather(
          params=self.x.sym_val,
          indices=self.indices.val,
          axis=self.axis.val,
          batch_dims=0,
      )
  
imports: import numpy
  from coremltools.converters.mil.mil import Operation, types
  from coremltools.converters.mil.mil.input_type import DefaultInputs, InputSpec, TensorInputType
  from coremltools.converters.mil.mil.operation import SYMBOL, VALUE, precondition
  from coremltools.converters.mil.mil.ops.defs._op_reqs import register_op
  from coremltools.converters.mil.mil.ops.defs._utils import compute_gather
  from coremltools.converters.mil.mil.types.symbolic import is_compatible_symbolic_vector
label_desc: Use image node_id 2 for calling the gather obj's underlying member method code with example usage: obj.value_inference() and returns: compute_gather, None