peal.architectures.basic_modules.SkipConnection

class peal.architectures.basic_modules.SkipConnection[source]

Bases: Module

Residual block module(x) + downsample(x) with a zennit Sum layer.

The two branches are stacked along a new last axis and summed with zennit.layer.Sum instead of + so that LRP attribution rules can be attached to the addition.

Parameters:
  • module (nn.Module) – Main branch.

  • downsample (nn.Module, optional) – Shortcut branch; nn.Identity when None. Its output must match the shape of module(x).

Methods

forward

Return the sum of the main branch and the shortcut branch.

__init__(module, downsample=None)[source]
forward(x_in)[source]

Return the sum of the main branch and the shortcut branch.