code: def avg_pool1d(
      x: torch.Tensor,
      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[torch.Tensor] = None,
  ) -> torch.Tensor:
      if isinstance(strides, int):
          strides = (strides,)
      elif len(strides) == 1:
          strides = (strides[0],)
  
      if isinstance(kernel, int):
          kernel = (kernel,)
      elif len(kernel) == 1:
          kernel = (kernel[0],)
  
      if data_format in ("NWC", "NCL"):
          x = x.permute(0, 2, 1)
  
      if (
          isinstance(padding, int)
          or not isinstance(padding, str)
          and padding[0][0] == padding[0][1]
      ) and not divisor_override:
          if not isinstance(padding, int):
              padding = padding[0][0]
          res = torch.nn.functional.avg_pool1d(
              x,
              kernel,
              strides,
              padding,
              count_include_pad=count_include_pad,
              ceil_mode=ceil_mode,
          )
      else:
          x_shape = x.shape[2]
          padding, pad_specific = _get_specific_pad(
              [x_shape], kernel, strides, padding, 1
          )
          x = torch.nn.functional.pad(x, padding, value=0.0)
  
          res = torch.nn.functional.avg_pool1d(
              x, kernel, strides, 0, ceil_mode
          )
  
          if not count_include_pad and any(pad_specific):
              num_padded_values = ivy.map(
                  _get_num_padded_values,
                  constant={
                      "p": pad_specific[0],
                      "n": x_shape,
                      "k": kernel[0],
                      "s": strides[0],
                  },
                  unique={
                      "i": torch.arange(res.shape[2]),
                  },
              )
              num_padded_values = torch.tensor(
                  num_padded_values, dtype=res.dtype
              )
              if ceil_mode:
                  _, c = _padding_ceil_mode(
                      x_shape, kernel[0], padding, strides[0], True
                  )
                  num_padded_values[-1] = _add_ceil_pad_to_pad_list(
                      num_padded_values[-1], kernel[0], c
                  )
              res = (kernel[0] * res) / (kernel[0] - num_padded_values)
  
      if data_format in ("NWC", "NCL"):
          res = res.permute(0, 2, 1)
  
      return res
  
imports: from typing import Optional, Union, Tuple, List, Literal, Sequence, Callable
  import torch
  import math
  import ivy
  from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
  from .None import backend_version
  from ivy.functional.ivy.layers import _handle_padding, _get_num_padded_values, _validate_max_pool_params, _depth_max_pooling_helper
  from ivy.functional.ivy.experimental.layers import _padding_ceil_mode, _broadcast_pooling_helper
label_desc: Use image node_id 7 for calling a global function with example usage: avg_pool1d() and returns: res