pulsatrix
Loading...
Searching...
No Matches
pulsatrix::lrp_composite Namespace Reference

Zennit 1.0.0's composite presets (zennit.composites), mapped onto pulsatrix modules by type: LinearModule = torch Linear, Conv2DModule = torch Conv2d; every other module gets the epsilon rule (the pass-through modules – ReLU, Flatten, Dropout, MaxPool – ignore it, as Zennit's Pass rule / plain gradient does). More...

Namespaces

namespace  detail
 

Functions

LRPComposite epsilon_plus (float epsilon=1e-6f)
 Zennit EpsilonPlus: Epsilon for Linear, ZPlus (AlphaBeta 1, 0) for Conv2D.
 
LRPComposite epsilon_alpha2_beta1 (float epsilon=1e-6f)
 Zennit EpsilonAlpha2Beta1: Epsilon for Linear, AlphaBeta(2, 1) for Conv2D.
 
LRPComposite epsilon_gamma_box (float low, float high, float gamma=0.25f, float epsilon=1e-6f)
 Zennit EpsilonGammaBox: ZBox(low, high) for the first Conv2D layer (lowest index), Gamma(gamma) for every other Conv2D, Epsilon for every Linear.
 

Detailed Description

Zennit 1.0.0's composite presets (zennit.composites), mapped onto pulsatrix modules by type: LinearModule = torch Linear, Conv2DModule = torch Conv2d; every other module gets the epsilon rule (the pass-through modules – ReLU, Flatten, Dropout, MaxPool – ignore it, as Zennit's Pass rule / plain gradient does).

Note
Every Epsilon entry sets epsilon_bias_in_denominator = true: Zennit's Epsilon rule puts the bias in z, so matching Zennit numerically requires it (this codebase's own default epsilon rule leaves the bias out to be conservative).

Function Documentation

◆ epsilon_alpha2_beta1()

LRPComposite pulsatrix::lrp_composite::epsilon_alpha2_beta1 ( float  epsilon = 1e-6f)
inline

Zennit EpsilonAlpha2Beta1: Epsilon for Linear, AlphaBeta(2, 1) for Conv2D.

◆ epsilon_gamma_box()

LRPComposite pulsatrix::lrp_composite::epsilon_gamma_box ( float  low,
float  high,
float  gamma = 0.25f,
float  epsilon = 1e-6f 
)
inline

Zennit EpsilonGammaBox: ZBox(low, high) for the first Conv2D layer (lowest index), Gamma(gamma) for every other Conv2D, Epsilon for every Linear.

Note
As in Zennit 1.0.0, whose first_map holds only Convolution: a Linear is never ZBox'd, even when it is the first layer, so on a Conv2D-free network this preset is Epsilon on every layer (checked against Zennit in tests/lrp_reference_test.cpp).
Remembers the first Conv2D it has seen since the last index-0 call (see LRPComposite's calling order).

◆ epsilon_plus()

LRPComposite pulsatrix::lrp_composite::epsilon_plus ( float  epsilon = 1e-6f)
inline

Zennit EpsilonPlus: Epsilon for Linear, ZPlus (AlphaBeta 1, 0) for Conv2D.