class_docstr: Scatter ``updates`` to ``data`` at locations ``indices``.
  
  The major differences from the previous version are illustrated in :py:class:`scatter`.
  For more information, see the iOS 15 :py:class:`~.iOS15.scatter_gather.scatter_nd`.
  
  Parameters
  ----------
  data: tensor<\*D, T> (Required)
  indices: tensor<\*K, i32> (Required)
  updates: tensor<\*K, T> (Required)
      * Must be the shape as ``K[:-1]+data.shape[K[-1]:]``.
  mode: const string (Optional)
      * Default to ``add``.
      * Can be the following modes: ``add``, ``div``, ``max``, ``min``, ``mul``, ``sub``, ``update``.
  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>
      * A tensor with the same shape and type as ``data``.
  
  Attributes
  ----------
  T: fp16, fp32, i32
class_docstr_tok: ["Scatter","``","updates","``","to","``","data","``","at","locations","``","indices","``",".","The","major","differences","from","the","previous","version","are","illustrated","in",":","py",":","class",":","`","scatter","`",".","For","more","information",",","see","the","iOS","15",":","py",":","class",":","`","~.iOS15.scatter_gather.scatter_nd","`",".","Parameters","--","--","--","--","--","data",":","tensor","<","\\","*","D",",","T",">","(","Required",")","indices",":","tensor","<","\\","*","K",",","i32",">","(","Required",")","updates",":","tensor","<","\\","*","K",",","T",">","(","Required",")","*","Must","be","the","shape","as","``","K","[",":","-1","]","+data.shape","[","K","[","-1","]",":","]","``",".","mode",":","const","string","(","Optional",")","*","Default","to","``","add","``",".","*","Can","be","the","following","modes",":","``","add","``",",","``","div","``",",","``","max","``",",","``","min","``",",","``","mul","``",",","``","sub","``",",","``","update","``",".","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",">","*","A","tensor","with","the","same","shape","and","type","as","``","data","``",".","Attributes","--","--","--","--","--","T",":","fp16",",","fp32",",","i32"]
code: def type_inference(self):
      result = super().type_inference()
      if self.validate_indices.val:
          indices = self.indices.val
          upper_bound = self.data.shape
          if indices is not None:
              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 scatter_nd obj's underlying member method code with example usage: obj.type_inference() and returns: result