peal.generators.deeplift_resnet

ResNet variants with one nn.ReLU instance per activation site.

Captum’s DeepLift hooks every ReLU module and requires each to be used exactly once per forward pass; torchvision’s ResNet reuses one relu inside every block, which breaks the attribution. These classes mirror torchvision’s BasicBlock / Bottleneck / ResNet with distinct non-inplace ReLUs so that DeepLift can attribute through them. They are used by the Stable Diffusion 3 generator when it rebuilds a predictor for attribution-guided sampling (DeepLiftResNet18 … 152).

Functions

DeepLiftResNet101

DeepLift-compatible ResNet-101 (bottlenecks [3, 4, 23, 3]).

DeepLiftResNet152

DeepLift-compatible ResNet-152 (bottlenecks [3, 8, 36, 3]).

DeepLiftResNet18

DeepLift-compatible ResNet-18 (basic blocks [2, 2, 2, 2]).

DeepLiftResNet34

DeepLift-compatible ResNet-34 (basic blocks [3, 4, 6, 3]).

DeepLiftResNet50

DeepLift-compatible ResNet-50 (bottlenecks [3, 4, 6, 3]).

Classes

DeepLiftBasicBlock

BasicBlock with separate ReLU instances for DeepLift compatibility

DeepLiftBottleneck

Bottleneck with separate ReLU instances for DeepLift compatibility

DeepLiftResNet

Base ResNet class with unique ReLU instances for DeepLift compatibility