class_docstr: General N-dimensional downsampling over a sliding window.
class_docstr_tok: ["General","N-dimensional","downsampling","over","a","sliding","window","."]
docstr: **Arguments:**
  
  - `x`: The input. Should be a JAX array of shape
      `(channels, dim_1, ..., dim_N)`, where `N = num_spatial_dims`.
  - `key`: Ignored; provided for compatibility with the rest of the Equinox API.
      (Keyword only argument.)
  
  **Returns:**
  
  A JAX array of shape `(channels, new_dim_1, ..., new_dim_N)`.
code: def __call__(
      self, x: Array, *, key: Optional[PRNGKeyArray] = None
  ) -> Array:
      """**Arguments:**
  
      - `x`: The input. Should be a JAX array of shape
          `(channels, dim_1, ..., dim_N)`, where `N = num_spatial_dims`.
      - `key`: Ignored; provided for compatibility with the rest of the Equinox API.
          (Keyword only argument.)
  
      **Returns:**
  
      A JAX array of shape `(channels, new_dim_1, ..., new_dim_N)`.
      """
      assert len(x.shape) == self.num_spatial_dims + 1, (
          f"Input should have {self.num_spatial_dims} spatial dimensions, "
          f"but input has shape {x.shape}"
      )
  
      if self.use_ceil:
          padding = self._update_padding_for_ceil(x.shape)
      else:
          padding = self.padding
  
      self._check_is_padding_valid(padding)
  
      x = jnp.moveaxis(x, 0, -1)
      x = jnp.expand_dims(x, axis=0)
      x = lax.reduce_window(
          x,
          self.init,
          self.operation,
          (1,) + self.kernel_size + (1,),
          (1,) + self.stride + (1,),
          ((0, 0),) + padding + ((0, 0),),
      )
  
      x = jnp.squeeze(x, axis=0)
      x = jnp.moveaxis(x, -1, 0)
      return x
  
imports: import math
  from collections.abc import Callable, Sequence
  from typing import Optional, Union
  import jax
  import jax.lax
  import jax.numpy
  import jax.random
  from jaxtyping import Array, PRNGKeyArray
  from .._module import field, Module
  from ._misc import all_sequences
label_desc: Use image node_id 4 for calling the Pool obj's underlying member method code with example usage: obj.__call__(x) and returns: x