ChannelsLast#

class composer.algorithms.ChannelsLast[source]#

Changes the memory format of the model to torch.channels_last. This usually improves GPU utilization.

Runs on Event.INIT`, so it can set the memory format before the model is DDP wrapped. Has no hyperparameters.

Example

from composer.algorithms import ChannelsLast
algorithm = ChannelsLast()
trainer = Trainer(
    model=model,
    train_dataloader=train_dataloader,
    eval_dataloader=eval_dataloader,
    max_duration="1ep",
    algorithms=[algorithm],
    optimizers=[optimizer]
)