class_docstr: Same as W**2 rule but sets all weights to ones.
class_docstr_tok: ["Same","as","W","*","*","2","rule","but","sets","all","weights","to","ones","."]
code: def __init__(
      self, layer: Layer, _state, copy_weights: bool = False
  ) -> None:
      # The flat rule works with weights equal to one and
      # no biases.
      if copy_weights:
          weights = layer.get_weights()
          if getattr(layer, "use_bias", False):
              weights = weights[:-1]
          weights = [np.ones_like(x) for x in weights]
      else:
          weights = layer.weights
          if getattr(layer, "use_bias", False):
              weights = weights[:-1]
          weights = [kbackend.ones_like(x) for x in weights]
  
      self._layer_wo_act_b = igraph.copy_layer_wo_activation(
          layer,
          keep_bias=False,
          weights=weights,
          name_template="reversed_kernel_%s",
      )
  
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 1 to create a new FlatRule object from inherited base classes: WSquareRule with example: obj = FlatRule(layer, _state, copy_weights)