class_docstr: Z_B rule from the Deep Taylor Decomposition
class_docstr_tok: ["Z_B","rule","from","the","Deep","Taylor","Decomposition"]
code: def apply(self, Xs, _Ys, Rs, reverse_state: dict):
      to_low = klayers.Lambda(lambda x: x * 0 + self._low)
      to_high = klayers.Lambda(lambda x: x * 0 + self._high)
  
      low = [to_low(x) for x in Xs]
      high = [to_high(x) for x in Xs]
  
      # Get values for the division.
      A = ibackend.apply(self._layer_wo_act, Xs)
      B = ibackend.apply(self._layer_wo_act_positive, low)
      C = ibackend.apply(self._layer_wo_act_negative, high)
      Zs = [
          klayers.Subtract()([a, klayers.Add()([b, c])])
          for a, b, c in zip(A, B, C)
      ]
  
      # Divide relevances with the value.
      tmp = [ibackend.safe_divide(a, b) for a, b in zip(Rs, Zs)]
      # Distribute along the gradient.
      grads_a = ibackend.gradients(Xs, A, tmp)
      grads_b = ibackend.gradients(low, B, tmp)
      grads_c = ibackend.gradients(high, C, tmp)
  
      tmp_a = [klayers.Multiply()([a, b]) for a, b in zip(Xs, grads_a)]
      tmp_b = [klayers.Multiply()([a, b]) for a, b in zip(low, grads_b)]
      tmp_c = [
          klayers.Multiply()([a, b]) for a, b in zip(high, grads_c)
      ]
  
      ret = [
          klayers.Subtract()([a, klayers.Add()([b, c])])
          for a, b, c in zip(tmp_a, tmp_b, tmp_c)
      ]
  
      return ret
  
imports: from __future__ import annotations
  import numpy
  import tensorflow.keras.backend
  import tensorflow.keras.layers
  import innvestigate.analyzer.relevance_based.utils
  import innvestigate.backend
  import innvestigate.backend.graph
  import innvestigate.layers
  from innvestigate.backend.types import Layer, OptionalList, Tensor
label_desc: Use image node_id 2 for calling the BoundedRule obj's underlying member method code with example usage: obj.apply(Xs, _Ys, Rs, reverse_state) and returns: ret