docstr: x_list contains a list of tensors to nest together and run
docstr_tok: ["x_list","contains","a","list","of","tensors","to","nest","together","and","run"]
code: def forward_nested(self, x_list: List[Tensor]) -> List[Tensor]:
      """
      x_list contains a list of tensors to nest together and run
      """
      assert isinstance(self.attn, MemEffAttention)
  
      if self.training and self.sample_drop_ratio > 0.0:
  
          def attn_residual_func(x: Tensor, attn_bias=None) -> Tensor:
              return self.attn(self.norm1(x), attn_bias=attn_bias)
  
          def ffn_residual_func(x: Tensor, attn_bias=None) -> Tensor:
              return self.mlp(self.norm2(x))
  
          x_list = drop_add_residual_stochastic_depth_list(
              x_list,
              residual_func=attn_residual_func,
              sample_drop_ratio=self.sample_drop_ratio,
              scaling_vector=self.ls1.gamma
              if isinstance(self.ls1, LayerScale)
              else None,
          )
          x_list = drop_add_residual_stochastic_depth_list(
              x_list,
              residual_func=ffn_residual_func,
              sample_drop_ratio=self.sample_drop_ratio,
              scaling_vector=self.ls2.gamma
              if isinstance(self.ls1, LayerScale)
              else None,
          )
          return x_list
      else:
  
          def attn_residual_func(x: Tensor, attn_bias=None) -> Tensor:
              return self.ls1(
                  self.attn(self.norm1(x), attn_bias=attn_bias)
              )
  
          def ffn_residual_func(x: Tensor, attn_bias=None) -> Tensor:
              return self.ls2(self.mlp(self.norm2(x)))
  
          attn_bias, x = get_attn_bias_and_cat(x_list)
          x = x + attn_residual_func(x, attn_bias=attn_bias)
          x = x + ffn_residual_func(x)
          return attn_bias.split(x)
  
imports: import logging
  import os
  from typing import Callable, List, Any, Tuple, Dict
  import warnings
  import torch
  from torch import nn, Tensor
  from .attention import Attention, MemEffAttention
  from .drop_path import DropPath
  from .layer_scale import LayerScale
  from .mlp import Mlp
label_desc: Use image node_id 1 for calling the NestedTensorBlock obj's underlying member method code with example usage: obj.forward_nested(x_list) and returns: x_list, attn_bias, self, self, self, self