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 layer_idx(self, layer_idx):
      idx = getattr(self, "_layer_idx", layer_idx)
      assert idx == layer_idx
      setattr(self, "_layer_idx", idx)
  
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 3 for calling the AdapterLayerBase obj's underlying member method code with example usage: obj.layer_idx(layer_idx) without return types