zennit.torchvision

Specialized Canonizers for models from torchvision.

Classes

ResNetBasicBlockCanonizer

Canonizer specifically for BasicBlocks of torchvision.models.resnet* type models.

ResNetBottleneckCanonizer

Canonizer specifically for Bottlenecks of torchvision.models.resnet* type models.

ResNetCanonizer

Canonizer for torchvision.models.resnet* type models.

VGGCanonizer

Canonizer for torchvision.models.vgg* type models.

class zennit.torchvision.ResNetBasicBlockCanonizer[source]

Bases: AttributeCanonizer

Canonizer specifically for BasicBlocks of torchvision.models.resnet* type models.

static forward(self, x)[source]

Modified BasicBlock forward for ResNet.

class zennit.torchvision.ResNetBottleneckCanonizer[source]

Bases: AttributeCanonizer

Canonizer specifically for Bottlenecks of torchvision.models.resnet* type models.

static forward(self, x)[source]

Modified Bottleneck forward for ResNet.

class zennit.torchvision.ResNetCanonizer[source]

Bases: CompositeCanonizer

Canonizer for torchvision.models.resnet* type models. This applies SequentialMergeBatchNorm, as well as add a Sum module to the Bottleneck modules and overload their forward method to use the Sum module instead of simply adding two tensors, such that forward and backward hooks may be applied.

class zennit.torchvision.VGGCanonizer[source]

Bases: SequentialMergeBatchNorm

Canonizer for torchvision.models.vgg* type models. This is so far identical to a SequentialMergeBatchNorm