code: def avg_pool3d(
      x: torch.Tensor,
      kernel: Union[int, Tuple[int], Tuple[int, int, int]],
      strides: Union[int, Tuple[int], Tuple[int, int, int]],
      padding: Union[str, int, List[Tuple[int, int]]],
      /,
      *,
      data_format: str = "NDHWC",
      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, strides, strides)
      elif len(strides) == 1:
          strides = (strides[0], strides[0], strides[0])
      if isinstance(kernel, int):
          kernel = (kernel, kernel, kernel)
      elif len(kernel) == 1:
          kernel = (kernel[0], kernel[0], kernel[0])
      if data_format == "NDHWC":
          x = x.permute(0, 4, 1, 2, 3)
  
      if (
          isinstance(padding, int)
          or not isinstance(padding, str)
          and all(pad[0] == pad[1] for pad in padding)
      ):
          if not isinstance(padding, int):
              padding = [padding[0][0], padding[1][0], padding[2][0]]
          res = torch.nn.functional.avg_pool3d(
              x,
              kernel,
              strides,
              padding,
              count_include_pad=count_include_pad,
              ceil_mode=ceil_mode,
              divisor_override=divisor_override,
          )
      else:
          x_shape = list(x.shape[2:])
          padding, pad_specific = _get_specific_pad(
              x_shape, kernel, strides, padding, 3
          )
          x = torch.nn.functional.pad(
              x,
              padding,
              value=0.0,
          )
          res = torch.nn.functional.avg_pool3d(
              x,
              kernel,
              strides,
              0,
              ceil_mode,
              divisor_override=divisor_override,
          )
  
          if (
              not count_include_pad
              and any(pad_specific)
              and not divisor_override
          ):
              num_padded_values = [
                  torch.tensor(
                      ivy.map(
                          _get_num_padded_values,
                          constant={
                              "p": pad_specific[i],
                              "n": x_shape[i],
                              "k": kernel[i],
                              "s": strides[i],
                          },
                          unique={
                              "i": torch.arange(res.shape[i + 2]),
                          },
                      ),
                      dtype=res.dtype,
                  )
                  for i in range(3)
              ]
              if ceil_mode:
                  for i in range(3):
                      num_padded_values = (
                          _adjust_num_padded_values_to_ceil(
                              pad_specific,
                              num_padded_values,
                              x_shape,
                              kernel,
                              strides,
                              3,
                          )
                      )
              num_padded_values1 = num_padded_values[0].reshape(
                  (-1, 1, 1)
              )
              num_padded_values2 = num_padded_values[1].reshape(
                  (1, -1, 1)
              )
              num_padded_values3 = num_padded_values[2].reshape(
                  (1, 1, -1)
              )
              num_padded_values = (
                  num_padded_values1 * kernel[1] * kernel[2]
                  + num_padded_values2 * kernel[0] * kernel[2]
                  + num_padded_values3 * kernel[0] * kernel[1]
                  + num_padded_values1
                  * num_padded_values2
                  * num_padded_values3
                  - num_padded_values1 * num_padded_values2 * kernel[2]
                  - num_padded_values1 * num_padded_values3 * kernel[1]
                  - num_padded_values2 * num_padded_values3 * kernel[0]
              )
              kernel_mul = kernel[0] * kernel[1] * kernel[2]
              res = (kernel_mul * res) / (
                  kernel_mul - num_padded_values
              )
  
      if data_format == "NDHWC":
          res = res.permute(0, 2, 3, 4, 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 10 for calling a global function with example usage: avg_pool3d() and returns: res