## Submodules¶

class salad.models.base.BaseModel

Bases: torch.nn.modules.module.Module

forward()

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class salad.models.base.ConditionalAdaptive

Bases: torch.nn.modules.module.Module

forward()

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class salad.models.gan.ConditionalGAN(d=128, n_classes=10, n_conditions=2, n_outputs=3)

Bases: torch.nn.modules.module.Module

forward(input, label, condition)

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

weight_init(mean, std)
class salad.models.gan.Discriminator(d=128, n_classes=1)

Bases: torch.nn.modules.module.Module

forward(input)

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

weight_init(mean, std)
salad.models.gan.cat2d(x, *args)
salad.models.gan.normal_init(m, mean, std)
salad.models.gan.to_one_hot(y, n_dims=None)

class salad.models.utils.CompressedResnet(backbone)

Bases: torch.nn.modules.module.Module

ResNet Variant where the batch norm statistics are merged into the transformation matrices

forward(x)

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class salad.models.utils.FixedBottleneck(conv, downsample)

Bases: torch.nn.modules.module.Module

forward(x)

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

salad.models.utils.FixedResnet(backbone)

ResNet Variant where each batch norm layer is replaced by a linear transformation

salad.models.utils.bn2linear(bn)
salad.models.utils.convert_conv_bn(layer, bn)
salad.models.utils.get_affine(layer)
salad.models.utils.reinit_bns(module)
salad.models.utils.replace_bns(module)