class_docstr: Take the values along ``axis`` at locations ``indices``.
  
  The major differences from the previous version are illustrated in :py:class:`gather`.
  For more information, see the iOS 16 :py:class:`~.iOS16.scatter_gather.gather_along_axis`.
  
  Parameters
  ----------
  x: tensor<\*D, T> (Required)
  indices: tensor<\*K, I> (Required)
      * ``rank(indices) == rank(x)``.
  axis: const i32 (Optional):
      * Default to ``0``.
  validate_indices: const bool (Optional)
      * If ``True``, it raises a runtime (possibly also a compile-time) exception for out-of-bound values of
        the ``indices`` parameter.
      * If ``False``, absolutely no checking is performed for out-of-bound values of ``indices``
        either at compile or runtime. Behavior for out-of-bound indices is undefined but memory safe.
      * Default value is ``False``.
  
  Returns
  -------
  tensor<\*D, T>:
      * Output tensor has the same shape as ``indices``.
  
  Attributes
  ----------
  T: fp16, fp32, int32, int16, uint16, int8, uint8
  I: int32, int16, uint16, int8, uint8
class_docstr_tok: ["Take","the","values","along","``","axis","``","at","locations","``","indices","``",".","The","major","differences","from","the","previous","version","are","illustrated","in",":","py",":","class",":","`","gather","`",".","For","more","information",",","see","the","iOS","16",":","py",":","class",":","`","~.iOS16.scatter_gather.gather_along_axis","`",".","Parameters","--","--","--","--","--","x",":","tensor","<","\\","*","D",",","T",">","(","Required",")","indices",":","tensor","<","\\","*","K",",","I",">","(","Required",")","*","``","rank","(","indices",")","==","rank","(","x",")","``",".","axis",":","const","i32","(","Optional",")",":","*","Default","to","``","0","``",".","validate_indices",":","const","bool","(","Optional",")","*","If","``","True","``",",","it","raises","a","runtime","(","possibly","also","a","compile-time",")","exception","for","out-of-bound","values","of","the","``","indices","``","parameter",".","*","If","``","False","``",",","absolutely","no","checking","is","performed","for","out-of-bound","values","of","``","indices","``","either","at","compile","or","runtime",".","Behavior","for","out-of-bound","indices","is","undefined","but","memory","safe",".","*","Default","value","is","``","False","``",".","Returns","--","--","--","-","tensor","<","\\","*","D",",","T",">",":","*","Output","tensor","has","the","same","shape","as","``","indices","``",".","Attributes","--","--","--","--","--","T",":","fp16",",","fp32",",","int32",",","int16",",","uint16",",","int8",",","uint8","I",":","int32",",","int16",",","uint16",",","int8",",","uint8"]
code: def type_inference(self):
      result = super().type_inference()
      if self.validate_indices.val:
          indices = self.indices.val
          if indices is not None:
              upper_bound = self.x.shape[self.axis.val]
              if np.count_nonzero(
                  np.logical_or(indices < 0, indices >= upper_bound)
              ):
                  raise IndexError(
                      f"Indices is out of bounds for `{self.op_type}` node {self.name}. "
                      f"Expected indices between [0, {upper_bound}), but got {indices}."
                  )
      return result
  
imports: import numpy
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.mil.input_type import DefaultInputs, InputSpec, TensorInputType
  from coremltools.converters.mil.mil.ops.defs._op_reqs import register_op
  from coremltools.converters.mil.mil.ops.defs.iOS15.scatter_gather import scatter
  from coremltools.converters.mil.mil.ops.defs.iOS15.scatter_gather import scatter_along_axis
  from coremltools.converters.mil.mil.ops.defs.iOS15.scatter_gather import scatter_nd
  from coremltools.converters.mil.mil.ops.defs.iOS16.scatter_gather import gather
  from coremltools.converters.mil.mil.ops.defs.iOS16.scatter_gather import gather_along_axis
  from coremltools.converters.mil.mil.ops.defs.iOS16.scatter_gather import gather_nd
  from coremltools.converters.mil.mil.ops.defs.iOS17 import _IOS17_TARGET
label_desc: Use image node_id 2 for calling the gather_along_axis obj's underlying member method code with example usage: obj.type_inference() and returns: result