class_docstr: Base class for all adaptation methods that require per-layer modules.
  
  Make sure the 'adapter_modules_name' attribute is overriden in derived classes.
class_docstr_tok: ["Base","class","for","all","adaptation","methods","that","require","per-layer","modules",".","Make","sure","the","'adapter_modules_name","'","attribute","is","overriden","in","derived","classes","."]
code: def _store_gating_score(self, adapter_name, gating_score):
      context = ForwardContext.get_context()
      if context.output_adapter_gating_scores:
          gating_cache = context.adapter_gating_scores
          if self.layer_idx not in gating_cache[adapter_name]:
              gating_cache[adapter_name][self.layer_idx] = {}
          gating_score = gating_score.detach().squeeze().cpu().numpy()
          if len(gating_score.shape) == 0:
              gating_score = np.expand_dims(gating_score, axis=0)
          cache_score = gating_cache[adapter_name][self.layer_idx].get(
              self.location_key, None
          )
          if cache_score is not None:
              gating_cache[adapter_name][self.layer_idx][
                  self.location_key
              ] = np.column_stack((cache_score, gating_score))
          else:
              gating_cache[adapter_name][self.layer_idx][
                  self.location_key
              ] = gating_score
  
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 5 for calling the AdapterLayerBase obj's underlying member method code with example usage: obj._store_gating_score(adapter_name, gating_score) without return types