class_docstr: This class is adapted from the compacter implementation at https://github.com/rabeehk/compacter
docstr: If factorized_phm_rules is set, phm_rule is a tuple, showing the left and right phm rules, and if this is not
  set, this is showing the phm_rule.
docstr_tok: ["If","factorized_phm_rules","is","set",",","phm_rule","is","a","tuple",",","showing","the","left","and","right","phm","rules",",","and","if","this","is","not","set",",","this","is","showing","the","phm_rule","."]
code: def set_phm_rule(
      self, phm_rule=None, phm_rule_left=None, phm_rule_right=None
  ):
      """
      If factorized_phm_rules is set, phm_rule is a tuple, showing the left and right phm rules, and if this is not
      set, this is showing the phm_rule.
      """
      if self.factorized_phm_rule:
          self.phm_rule_left = phm_rule_left
          self.phm_rule_right = phm_rule_right
      else:
          self.phm_rule = phm_rule
  
imports: import math
  import torch
  from torch import nn
  from transformers.activations import get_activation
  from ..configuration import AdapterFusionConfig, BnConfig
  from ..context import ForwardContext
label_desc: Use image node_id 4 for calling the PHMLayer obj's underlying member method code with example usage: obj.set_phm_rule(phm_rule, phm_rule_left, phm_rule_right) without return types