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:**
  
  - `target_shape`: The target output shape.
  - `num_spatial_dims`: The number of spatial dimensions.
  - `operation`: The operation applied for downsample.
code: def __init__(
      self,
      target_shape: Union[int, Sequence[int]],
      num_spatial_dims: int,
      operation: Callable,
  ):
      """**Arguments:**
  
      - `target_shape`: The target output shape.
      - `num_spatial_dims`: The number of spatial dimensions.
      - `operation`: The operation applied for downsample.
      """
      self.operation = operation
      if isinstance(target_shape, int):
          self.target_shape = (target_shape,) * num_spatial_dims
      elif (
          isinstance(target_shape, Sequence)
          and len(target_shape) == num_spatial_dims
      ):
          self.target_shape = target_shape
      else:
          raise ValueError(
              "`target_size` must either be an int or tuple of length "
              f"{num_spatial_dims} containing ints."
          )
  
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 1 to create a new AdaptivePool object from inherited base classes: Module with example: obj = AdaptivePool(target_shape, num_spatial_dims, operation)