composer.functional

Algorithms can be used directly through our functions-based API.

from composer import functional as CF
from torchvision import models

model = models.resnet50()

# replace some layers with blurpool
CF.apply_blurpool(model)
# replace some layers with squeeze-excite
CF.apply_se(model, latent_channels=64, min_channels=128)

functional.augment_and_mix

Applies AugMix (Hendrycks et al.) data augmentation to an image.

functional.apply_blurpool

Add anti-aliasing filters to the strided torch.nn.Conv2d and/or torch.nn.MaxPool2d modules within model.

functional.apply_alibi

Removes position embeddings and replaces the attention function and attention mask according to AliBi.

functional.colout

Drops random rows and columns from a single image.

functional.cutout

See CutOut.

functional.smooth_labels

Shrinks targets towards a uniform distribution to counteract label noise as in Szegedy et al..

functional.freeze_layers

Progressively freeze the layers of the network during training, starting with the earlier layers.

functional.apply_ghost_batchnorm

Replace batch normalization modules with ghost batch normalization modules.

functional.mixup_batch

Create new samples using convex combinations of pairs of samples.

functional.resize_inputs

Resize inputs and optionally outputs by cropping or interpolating.

functional.randaugment

Randomly applies a sequence of image data augmentations (Cubuk et al. 2019).

functional.scale_scheduler

Makes a learning rate schedule take a different number of epochs.

functional.selective_backprop

Select a subset of the batch on which to learn as per (Jiang et al. 2019).

functional.apply_se

See SqueezeExcite

functional.apply_seq_length_warmup

Progressively increases the sequence length during training.

functional.apply_stochastic_depth

Applies Stochastic Depth (Huang et al.) to the specified model.