types#

Reference for common types used throughout the composer library.

composer.core.types.Batch[source]#

Alias to type Any. A batch of data can be represented in several formats, depending on the application.

Type

Any

composer.core.types.PyTorchScheduler[source]#

Alias for base class of learning rate schedulers such as torch.optim.lr_scheduler.ConstantLR.

Type

torch.optim.lr_scheduler._LRScheduler

composer.core.types.JSON[source]#

JSON Data.

Type

str | float | int | None | List[โ€™JSONโ€™] | Dict[str, โ€™JSONโ€™]

composer.core.types.Dataset[source]#

Alias for torch.utils.data.Dataset.

Type

Dataset[Batch]

Classes

MemoryFormat

Enum class to represent different memory formats.

_LRScheduler

Module _LRScheduler.

Attributes

class composer.core.types.MemoryFormat(value)[source]#

Bases: composer.utils.string_enum.StringEnum

Enum class to represent different memory formats.

See torch.torch.memory_format for more details.

CONTIGUOUS_FORMAT#

Default PyTorch memory format represnting a tensor allocated with consecutive dimensions sequential in allocated memory.

CHANNELS_LAST#

This is also known as NHWC. Typically used for images with 2 spatial dimensions (i.e., Height and Width) where channels next to each other in indexing are next to each other in allocated memory. For example, if C[0] is at memory location M_0 then C[1] is at memory location M_1, etc.

CHANNELS_LAST_3D#

This can also be referred to as NTHWC. Same as CHANNELS_LAST but for videos with 3 spatial dimensions (i.e., Time, Height and Width).

PRESERVE_FORMAT#

A way to tell operations to make the output tensor to have the same memory format as the input tensor.

class composer.core.types.TrainerMode(value)[source]#

Bases: composer.utils.string_enum.StringEnum

Enum to represent which mode the Trainer is in.

TRAIN#

In training mode.

EVAL#

In evaluation mode.

PREDICT#

In predict mode.