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

Perform augmentations.

functional.apply_blurpool

Applies BlurPool algorithm to the provided model.

functional.colout

Drops random rows and columns from a single image.

functional.cutout

Implements CutOut augmentation from https://arxiv.org/abs/1708.04552 on the batch level.

functional.smooth_labels

Shrinks targets towards a prior distribution to counteract label noise.

functional.freeze_layers

Implements the layer freezing algorithm.

functional.mixup_batch

Implements mixup on a single batch of data.

functional.resize_inputs

Resize inputs and optionally outputs by cropping or interpolating.

functional.randaugment

Perform augmentations.

functional.scale_scheduler

functional.selective_backprop

Select a subset of the batch on which to learn.

functional.apply_se

Adds Squeeze-and-Excitation <https://arxiv.org/abs/1709.01507>`_ (SE) blocks after the Conv2d layers of a neural network.