class_docstr: Class for computing the relevance propagation and supplying
  the necessary forward hooks for all layers.
class_docstr_tok: ["Class","for","computing","the","relevance","propagation","and","supplying","the","necessary","forward","hooks","for","all","layers","."]
docstr: This method computes the backward pass for the incoming relevance
  for the specified layer.
  
  Args:
      layer: Layer to be reverted.
      relevance: Incoming relevance from higher up in the network.
  
  Returns:
      The
docstr_tok: ["This","method","computes","the","backward","pass","for","the","incoming","relevance","for","the","specified","layer",".","Args",":","layer",":","Layer","to","be","reverted",".","relevance",":","Incoming","relevance","from","higher","up","in","the","network",".","Returns",":","The"]
code: def compute_propagated_relevance(self, layer, relevance):
      """
      This method computes the backward pass for the incoming relevance
      for the specified layer.
  
      Args:
          layer: Layer to be reverted.
          relevance: Incoming relevance from higher up in the network.
  
      Returns:
          The
  
      """
  
      if isinstance(
          layer,
          (torch.nn.MaxPool1d, torch.nn.MaxPool2d, torch.nn.MaxPool3d),
      ):
          return self.max_pool_nd_inverse(layer, relevance).detach()
  
      elif isinstance(
          layer, (torch.nn.Conv1d, torch.nn.Conv2d, torch.nn.Conv3d)
      ):
          return self.conv_nd_inverse(layer, relevance).detach()
  
      elif isinstance(layer, torch.nn.LogSoftmax):
          # Only layer that does not conserve relevance. Mainly used
          # to make probability out of the log values. Should probably
          # be changed to pure passing and the user should make sure
          # the layer outputs are sensible (0 would be 100% class probability,
          # but no relevance could be passed on).
          if relevance.sum() < 0:
              relevance[relevance == 0] = -1e6
              relevance = relevance.exp()
              if not self.warned_log_softmax:
                  print(
                      "WARNING: LogSoftmax layer was "
                      "turned into probabilities."
                  )
                  self.warned_log_softmax = True
          return relevance
      elif isinstance(layer, self.allowed_pass_layers):
          # The above layers are one-to-one mappings of input to
          # output nodes. All the relevance in the output will come
          # entirely from the input node. Given the conservation
          # of relevance, the input is as relevant as the output.
          return relevance
  
      elif isinstance(layer, torch.nn.Linear):
          return self.linear_inverse(layer, relevance).detach()
      else:
          raise NotImplementedError(
              "The network contains layers that"
              " are currently not supported {0:s}".format(str(layer))
          )
  
imports: import torch
  import torch.nn
  import numpy
  import torch.nn.functional
label_desc: Use image node_id 3 for calling the RelevancePropagator obj's underlying member method code with example usage: obj.compute_propagated_relevance(layer, relevance) and returns: self, self, relevance, relevance, self