class_docstr: Vision Transformer with support for patch or hybrid CNN input stage
      
class_docstr_tok: ["Vision","Transformer","with","support","for","patch","or","hybrid","CNN","input","stage"]
code: def forward_head(
      self, xs: List[torch.Tensor], pre_logits: bool = False
  ) -> torch.Tensor:
      xs = (
          [x[:, 1:].mean(dim=1) for x in xs]
          if self.global_pool == "avg"
          else [x[:, 0] for x in xs]
      )
      xs = [self.head_drop(x) for x in xs]
      if pre_logits or isinstance(self.head[0], nn.Identity):
          return torch.cat([x for x in xs], dim=1)
      return torch.mean(
          torch.stack(
              [head(xs[i]) for i, head in enumerate(self.head)], dim=0
          ),
          dim=0,
      )
  
imports: from functools import partial
  from typing import List
  from typing import Tuple
  import torch
  import torch.hub
  import torch.nn
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
  from timm.layers import DropPath, to_2tuple, trunc_normal_, _assert
  from ._builder import build_model_with_cfg
  from ._features_fx import register_notrace_function
  from ._registry import register_model, generate_default_cfgs
  from .vision_transformer import Block
label_desc: Use image node_id 9 for calling the CrossVit obj's underlying member method code with example usage: obj.forward_head(xs, pre_logits) and returns: torch, torch