class_docstr: General N dimensional adaptive downsampling to a target shape.
class_docstr_tok: ["General","N","dimensional","adaptive","downsampling","to","a","target","shape","."]
docstr: **Arguments:**
  
  - `x`: The input. Should be a JAX array of shape
      `(channels, dim_1, dim_2, ... )`.
  - `key`: Ignored; provided for compatibility with the rest of the Equinox API.
      (Keyword only argument.)
  
  **Returns:**
  
  A JAX array of shape `(channels,) + target_shape`.
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_2, ... )`.
      - `key`: Ignored; provided for compatibility with the rest of the Equinox API.
          (Keyword only argument.)
  
      **Returns:**
  
      A JAX array of shape `(channels,) + target_shape`.
      """
      if x.ndim - 1 != len(self.target_shape):
          raise ValueError(
              f"Expected input with {len(self.target_shape)} dimensions, "
              f"received {x.ndim-1} instead."
          )
      for i in range(1, x.ndim):
          op = jax.vmap(
              _adaptive_pool1d, (0, None, None), 0
          )  # batching over channels by default
          for j in range(1, x.ndim):
              if i == j:
                  continue
              op = jax.vmap(op, in_axes=(j, None, None), out_axes=j)
          x = op(x, self.target_shape[i - 1], self.operation)
      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 2 for calling the AdaptivePool obj's underlying member method code with example usage: obj.__call__(x) and returns: x