class_docstr: W**2 rule from Deep Taylor Decomposition
class_docstr_tok: ["W","*","*","2","rule","from","Deep","Taylor","Decomposition"]
code: def apply(
      self,
      Xs: list[Tensor],
      Ys: list[Tensor],
      Rs: list[Tensor],
      _reverse_state: dict,
  ) -> list[Tensor]:
      # Create dummy forward path to take the derivative below.
      Ys = ibackend.apply(self._layer_wo_act_b, Xs)
  
      # Compute the sum of the weights.
      ones = ilayers.OnesLike()(Xs)
      Zs = [self._layer_wo_act_b(X) for X in ones]
      # Weight the incoming relevance.
      tmp = [ilayers.SafeDivide()([a, b]) for a, b in zip(Rs, Zs)]
      # Redistribute the relevances along the gradient.
      grads = ibackend.gradients(Xs, Ys, tmp)
      return 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 WSquareRule obj's underlying member method code with example usage: obj.apply(Xs, Ys, Rs, _reverse_state) and returns: grads