code: def _select_and_scatter_add_impl(
      source,
      operand,
      *,
      select_prim,
      window_dimensions,
      window_strides,
      padding,
      expand_padding,
  ):
      dtype = source.dtype
      select = lambda x, y: select_prim.bind(x, y)
      scatter = lax.bitwise_or if dtype == np.bool_ else lax.add
      if expand_padding:
          operand_shape = operand.shape
          original_padding = padding
          identity = (
              lax._get_max_identity
              if select_prim is lax.ge_p
              else lax._get_min_identity
          )
          pads = [(lo, hi, 0) for (lo, hi) in padding]
          operand = lax.pad(operand, identity(dtype), pads)
          padding = [(0, 0) for _ in padding]
      out = _select_and_scatter(
          operand,
          select,
          window_dimensions,
          window_strides,
          padding,
          source,
          lax._zero(operand),
          scatter,
      )
      if expand_padding:
          start_indices = [lo for (lo, hi) in original_padding]
          stop_indices = [
              lo + d
              for ((lo, hi), d) in zip(original_padding, operand_shape)
          ]
          out = slicing.slice(out, start_indices, stop_indices)
      return out
  
imports: from __future__ import annotations
  from collections.abc import Sequence
  from functools import partial
  from typing import Callable
  import warnings
  import numpy
  from jax import tree_util
  from jax._src import ad_util
  from jax._src import core
  from jax._src import dispatch
  from jax._src import dtypes
  from jax._src import util
  from jax._src.core import ShapedArray, ConcreteArray
  from jax._src.interpreters import ad
  from jax._src.interpreters import batching
  from jax._src.interpreters import mlir
  from jax._src.lax import lax
  from jax._src.lax import convolution
  from jax._src.lax import slicing
  from jax._src.lib.mlir import ir
  from jax._src.lib.mlir.dialects import hlo
  from jax._src.numpy.ufuncs import logaddexp
  from jax._src.typing import Array
label_desc: Use image node_id 27 for calling a global function with example usage: _select_and_scatter_add_impl(source, operand) and returns: out