code: def mean(
      self, states: List[BottleneckState], weights: torch.Tensor
  ) -> BottleneckState:
      return BottleneckState(
          torch.mean(
              torch.stack([s.hidden_states for s in states], 0)
              * weights,
              dim=0,
          ),
          states[0].input_tensor,
          states[0].adapter_residual,
          states[0].layer_norm,
          states[0].bottleneck_up,
      )
  
imports: from typing import Dict, List, Mapping, NamedTuple, Optional, Union
  import torch
  from torch import nn
  from ..composition import AdapterCompositionBlock, Average, BatchSplit, Fuse, Parallel, Split, Stack, adjust_tensors_for_parallel
  from ..configuration import BnConfig
  from ..context import ForwardContext
  from .adapter_layer_base import ComposableAdapterLayerBase
  from .modeling import Adapter, BertFusion, ParallelAdapter
label_desc: Use image node_id 15 for calling the BottleneckLayer obj's underlying member method code with example usage: obj.mean(states, weights) and returns: BottleneckState