code: def avg_pool1d(
      x: np.ndarray,
      kernel: Union[int, Tuple[int]],
      strides: Union[int, Tuple[int]],
      padding: Union[str, int, List[Tuple[int, int]]],
      /,
      *,
      data_format: str = "NWC",
      count_include_pad: bool = False,
      ceil_mode: bool = False,
      divisor_override: Optional[int] = None,
      out: Optional[np.ndarray] = None,
  ) -> np.ndarray:
      if isinstance(kernel, int):
          kernel = [kernel]
      elif len(kernel) == 1:
          kernel = [kernel[0]]
  
      if isinstance(strides, int):
          strides = [strides]
      elif len(strides) == 1:
          strides = [strides[0]]
  
      if data_format in ("NCW", "NCL"):
          x = np.swapaxes(x, 1, 2)
  
      x_shape = x.shape[1:-1]
      padding, pad_specific, c = _get_padded_values(
          x_shape, kernel, strides, padding, ceil_mode, 1
      )
  
      x = np.pad(
          x,
          [
              (0, 0),
              *padding,
              (0, 0),
          ],
          constant_values=0.0,
      )
  
      x_shape = x.shape
      new_w = (x_shape[1] - kernel[0]) // strides[0] + 1
      new_shape = [x_shape[0], new_w, kernel[0]] + [x_shape[-1]]
      new_strides = (
          x.strides[0],
          x.strides[1] * strides[0],
          x.strides[1],
          x.strides[2],
      )
  
      sub_matrices = np.lib.stride_tricks.as_strided(
          x, new_shape, new_strides, writeable=False
      )
  
      res = np.mean(sub_matrices, axis=2)
  
      if (not count_include_pad or ceil_mode) and any(pad_specific):
          if not count_include_pad:
              num_padded_values = np.array(
                  ivy.map(
                      _get_num_padded_values,
                      constant={
                          "p": pad_specific[0],
                          "n": x.shape[1] - pad_specific[0],
                          "k": kernel[0],
                          "s": strides[0],
                      },
                      unique={
                          "i": np.arange(res.shape[1]),
                      },
                  ),
                  dtype=res.dtype,
              )
          else:
              num_padded_values = np.zeros(
                  res.shape[1], dtype=res.dtype
              )
              num_padded_values[-1] = c[0]
          res = (kernel[0] * res) / (
              kernel[0] - num_padded_values[:, None]
          )
  
      if data_format in ("NCW", "NCL"):
          return res.swapaxes(1, 2)
  
      return res
  
imports: import math
  import numpy
  from typing import Optional, Union, Tuple, List, Literal, Sequence, Callable
  import ivy
  from ivy.functional.ivy.layers import _handle_padding, _get_num_padded_values, _validate_max_pool_params, _depth_max_pooling_helper
  from ivy.functional.backends.numpy.layers import _add_dilations
  from ivy.functional.ivy.experimental.layers import _padding_ceil_mode
  from ivy.func_wrapper import with_supported_dtypes
  from ivy.func_wrapper import with_unsupported_dtypes
  from .None import backend_version
label_desc: Use image node_id 6 for calling a global function with example usage: avg_pool1d() and returns: res, res