class_docstr: Base class for all adapter methods that support composition.
  
  Make sure the 'adapter_modules_name' and 'supported_compositions' attributes as well as all abstract methods are
  overriden in derived classes. 'allow_multi_parallelize' can be set to True to allow inputs to be parallelized
  independently multiple times. This is useful when there are multiple parallel input flows through an adapter layer
  (e.g. in LoRA).
class_docstr_tok: ["Base","class","for","all","adapter","methods","that","support","composition",".","Make","sure","the","'adapter_modules_name","'","and","'supported_compositions","'","attributes","as","well","as","all","abstract","methods","are","overriden","in","derived","classes",".","'allow_multi_parallelize","'","can","be","set","to","True","to","allow","inputs","to","be","parallelized","independently","multiple","times",".","This","is","useful","when","there","are","multiple","parallel","input","flows","through","an","adapter","layer","(","e.g",".","in","LoRA",")","."]
docstr: Averages the given states along the batch size dimension by the given weights.
  This is e.g. used by the Average composition block. IMPORTANT: Has to be implemented by all derived classes.
  
  Args:
      states (List[NamedTuple]): The states to be averaged.
      weights (torch.Tensor): The averaging weights.
  
  Returns:
      NamedTuple: The averaged state.
docstr_tok: ["Averages","the","given","states","along","the","batch","size","dimension","by","the","given","weights",".","This","is","e.g",".","used","by","the","Average","composition","block",".","IMPORTANT",":","Has","to","be","implemented","by","all","derived","classes",".","Args",":","states","(","List","[","NamedTuple","]",")",":","The","states","to","be","averaged",".","weights","(","torch.Tensor",")",":","The","averaging","weights",".","Returns",":","NamedTuple",":","The","averaged","state","."]
code: def mean(
      self, states: List[NamedTuple], weights: torch.Tensor
  ) -> NamedTuple:
      """Averages the given states along the batch size dimension by the given weights.
      This is e.g. used by the Average composition block. IMPORTANT: Has to be implemented by all derived classes.
  
      Args:
          states (List[NamedTuple]): The states to be averaged.
          weights (torch.Tensor): The averaging weights.
  
      Returns:
          NamedTuple: The averaged state.
      """
      raise NotImplementedError()
  
imports: from abc import ABCMeta, abstractmethod
  from typing import Collection, Dict, List, NamedTuple, Union
  import numpy
  import torch
  from torch import nn
  from ..composition import ALLOWED_NESTINGS, AdapterCompositionBlock, Average, BatchSplit, Fuse, Parallel, Split, Stack
  from ..context import AdapterSetup, ForwardContext
label_desc: Use image node_id 8 for calling the ComposableAdapterLayerBase obj's underlying member method code with example usage: obj.mean(states, weights) without return types