code: def _validate_reduce_window_inputs(
      operand_shape,
      computation_name,
      dtype,
      window_dimensions,
      window_strides,
      base_dilation,
      window_dilation,
  ):
      if computation_name not in ["min", "max", "add"]:
          raise _reduce_error(
              "Reduction function should be either min, max, or add."
          )
      if computation_name in ["min", "max"] and dtype in [
          tf.bool,
          tf.uint32,
          tf.uint64,
          tf.complex64,
          tf.complex128,
      ]:
          raise _reduce_error(
              "Min/max pool does not support operands of type "
              f"{dtype}"
          )
      if computation_name == "min" and dtype in [tf.uint8, tf.uint16]:
          # TODO(marcvanzee): We currently implement min pooling by negating the
          # input, but this doesn't work for uint. We could work around it using
          # tf.math.reduce_min.
          raise _reduce_error(
              f"Min pool does not support operands of type {dtype}"
          )
      if computation_name == "add" and dtype not in [
          tf.float16,
          tf.float32,
          tf.float64,
          tf.int16,
          tf.int32,
      ]:
          raise _reduce_error(
              "Add pooling does not support operands of type "
              f"{dtype}"
          )
  
      if (
          len(operand_shape)
          != len(window_dimensions)
          != len(window_strides)
          != len(window_dilation)
      ):
          raise _reduce_error(
              "Input shapes, window dimensions, window stride "
              "dimensions, and window dilation dimensions should "
              "match."
          )
  
      has_only_spatial_dims = True
      if len(operand_shape) > 4:
          raise _reduce_error("Only 1D or 2D input are supported.")
      if len(operand_shape) > 2:
          # operand_shape = (batch, spatial_dims, ..., channel).
          has_only_spatial_dims = False
  
          for name, value in [
              ("window_dimensions", window_dimensions),
              ("window_strides", window_strides),
              ("window_dilation", window_dilation),
          ]:
              if value[0] != value[-1] != 1:
                  raise _reduce_error(
                      "Only 1D or 2D input are supported, expected "
                      f"{name}=(1, spatial_dims, ..., 1), but got "
                      f"{value}"
                  )
  
      if list(base_dilation) != [1] * len(operand_shape):
          # TODO(marcvanzee): Add support for base dilations. We can do this using
          # a scatter on operand.
          raise _reduce_error(
              "Unimplemented support for base dilation."
          )
  
      return has_only_spatial_dims
  
imports: from __future__ import annotations
  import builtins
  from collections.abc import Sequence
  import dataclasses
  from functools import partial, wraps
  import math
  import string
  from typing import Any, Callable, Optional
  from jax._src import core
  from jax import lax
  from jax._src.lax import slicing
  from jax._src import dtypes
  from jax._src import util
  from jax.experimental.jax2tf import jax2tf
  import numpy
  import tensorflow
label_desc: Use image node_id 19 for calling a global function with example usage: _validate_reduce_window_inputs(operand_shape, computation_name, dtype, window_dimensions, window_strides, base_dilation, window_dilation) and returns: has_only_spatial_dims