code: def attention_pool(x, pool, norm=None):
      # (B, H, W, C) -> (B, C, H, W)
      x = x.permute(0, 3, 1, 2)
      x = pool(x)
      # (B, C, H1, W1) -> (B, H1, W1, C)
      x = x.permute(0, 2, 3, 1)
      if norm:
          x = norm(x)
  
      return x
  
file_path: detectron2/detectron2/modeling/backbone/mvit.py
imports: import logging
  import numpy
  import torch
  import torch.nn
  from .backbone import Backbone
  from .utils import PatchEmbed, add_decomposed_rel_pos, get_abs_pos, window_partition, window_unpartition
label_desc: Use image node_id 1 for calling a global function with example usage: attention_pool(x, pool, norm) and returns: x