code: def adaptive_avg_pool2d(
      input, output_size, /, *, data_format: str = "NHWC"
  ):
      squeeze = False
      if input.ndim == 3:
          input = torch.unsqueeze(input, 0)
          squeeze = True
      permuted_input = False
      if data_format == "NHWC":
          input = torch.permute(
              input, (0, input.ndim - 1, *range(1, input.ndim - 1))
          )
          permuted_input = True
      ret = torch.nn.functional.adaptive_avg_pool2d(input, output_size)
      ret = (
          torch.permute(ret, (0, *range(2, input.ndim), 1))
          if permuted_input
          else ret
      )
      ret = torch.squeeze(ret, 0) if squeeze else ret
      return ret
  
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 23 for calling a global function with example usage: adaptive_avg_pool2d() and returns: ret