Device#
- class composer.devices.Device[source]#
Abstract class for a device on which a model runs.
- dist_backend#
Distributed backend to use. Should be
gloo
,mpi
, ornccl
. See the pytorch docs for details.- Type
- batch_to_device(batch)[source]#
Invoked by the
Trainer
move all tensors items in a batch to device.Supports nested sequences and mappings of tensors. Ignores non-tensor items. Preserves sequence and mapping types when possible; otherwise, sequences are converted to lists, and mappings are converted to dictionaries.
- Parameters
batch (Any) โ The batch to move to the device.
- Returns
Batch โ The batch on the device.
- abstract module_to_device(module)[source]#
Invoked by the
Trainer
to move amodule
onto the device.- Parameters
module (Module) โ The module to move to the device.
- Returns
torch.nn.Module โ The module on the device.