class_docstr: Helper object to call indexed update functions for an (advanced) index.
  
  This object references a source array and a specific indexer into that array.
  Methods on this object return copies of the source array that have been
  modified at the positions specified by the indexer.
class_docstr_tok: ["Helper","object","to","call","indexed","update","functions","for","an","(","advanced",")","index",".","This","object","references","a","source","array","and","a","specific","indexer","into","that","array",".","Methods","on","this","object","return","copies","of","the","source","array","that","have","been","modified","at","the","positions","specified","by","the","indexer","."]
docstr: Pure equivalent of ``func.at(x, idx)`` for a unary ufunc ``func``.
  
  Returns the value of ``x`` that would result from applying the unary
  function ``func`` to ``x`` at the given indices. This is similar to
  ``x.at[idx].set(func(x[idx]))``, but differs in the case of repeated indices:
  in ``x.at[idx].apply(func)``, repeated indices result in the function being
  applied multiple times.
  
  Note that in the current implementation, ``scatter_apply`` is not compatible
  with automatic differentiation.
  
  See :mod:`jax.ops` for details.
docstr_tok: ["Pure","equivalent","of","``","func.at","(","x",",","idx",")","``","for","a","unary","ufunc","``","func","``",".","Returns","the","value","of","``","x","``","that","would","result","from","applying","the","unary","function","``","func","``","to","``","x","``","at","the","given","indices",".","This","is","similar","to","``","x.at","[","idx","]",".set","(","func","(","x","[","idx","]",")",")","``",",","but","differs","in","the","case","of","repeated","indices",":","in","``","x.at","[","idx","]",".apply","(","func",")","``",",","repeated","indices","result","in","the","function","being","applied","multiple","times",".","Note","that","in","the","current","implementation",",","``","scatter_apply","``","is","not","compatible","with","automatic","differentiation",".","See",":","mod",":","`","jax.ops","`","for","details","."]
code: def apply(
      self,
      func,
      *,
      indices_are_sorted=False,
      unique_indices=False,
      mode=None,
  ):
      """Pure equivalent of ``func.at(x, idx)`` for a unary ufunc ``func``.
  
      Returns the value of ``x`` that would result from applying the unary
      function ``func`` to ``x`` at the given indices. This is similar to
      ``x.at[idx].set(func(x[idx]))``, but differs in the case of repeated indices:
      in ``x.at[idx].apply(func)``, repeated indices result in the function being
      applied multiple times.
  
      Note that in the current implementation, ``scatter_apply`` is not compatible
      with automatic differentiation.
  
      See :mod:`jax.ops` for details.
      """
  
      def _scatter_apply(x, indices, y, dims, **kwargs):
          return lax.scatter_apply(
              x, indices, func, dims, update_shape=y.shape, **kwargs
          )
  
      return scatter._scatter_update(
          self.array,
          self.index,
          lax_internal._zero(self.array.dtype),
          _scatter_apply,
          indices_are_sorted=indices_are_sorted,
          unique_indices=unique_indices,
          mode=mode,
      )
  
imports: from __future__ import annotations
  import abc
  from functools import partial, wraps
  import math
  from typing import Any
  import numpy
  import jax
  from jax import lax
  from jax._src import core
  from jax._src import dtypes
  from jax._src.api_util import _ensure_index_tuple
  from jax._src.array import ArrayImpl
  from jax._src.lax import lax
  from jax._src.numpy import lax_numpy
  from jax._src.numpy import reductions
  from jax._src.numpy import ufuncs
  from jax._src.numpy import util
  from jax._src.ops import scatter
  from jax._src.typing import Array, ArrayLike, DimSize, DTypeLike, Shape
  from jax._src.util import safe_zip, safe_map
label_desc: Use image node_id 5 for calling the _IndexUpdateRef obj's underlying member method code with example usage: obj.apply(func) and returns: scatter, lax