class_docstr: The ZPlus rule is a special case of the AlphaBetaRule
  for alpha=1, beta=0 and assumes inputs x >= 0.
class_docstr_tok: ["The","ZPlus","rule","is","a","special","case","of","the","AlphaBetaRule","for","alpha=1",",","beta=0","and","assumes","inputs","x",">","=","0","."]
code: def apply(self, Xs, _Ys, Rs, reverse_state: dict):
      # TODO: assert all inputs are positive, instead of only keeping the positives.
      # keep_positives = klayers.Lambda(
      #     lambda x: x * kbackend.cast(kbackend.greater(x, 0), kbackend.floatx())
      # )
      # Xs = ibackend.apply(keep_positives, Xs)
  
      # Get activations.
      Zs = ibackend.apply(self._layer_wo_act_b_positive, Xs)
      # Divide incoming relevance by the activations.
      tmp = [ibackend.safe_divide(a, b) for a, b in zip(Rs, Zs)]
      # Propagate the relevance to input neurons
      # using the gradient.
      grads = ibackend.gradients(Xs, Zs, tmp)
      # Re-weight relevance with the input values.
      return [klayers.Multiply()([a, b]) for a, b in zip(Xs, grads)]
  
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 ZPlusFastRule obj's underlying member method code with example usage: obj.apply(Xs, _Ys, Rs, reverse_state) and returns: unknown