Type Aliases
Types and type aliases used by NPFL138.
npfl138.AnyArray
module-attribute
A type alias for any array-like structure.
PyTorch tensors, NumPy arrays, lists, and tuples are supported.
npfl138.DataFormat
module-attribute
A type alias for image data format description.
npfl138.HasCompute
npfl138.Logs
module-attribute
A dictionary of logs, with keys being the log names and values being the log values.
When the logs are returned by a npfl138.TrainableModule or passed to a npfl138.Callback, they are always evaluated to just float values.
npfl138.Reduction
module-attribute
A type alias for reduction methods used in losses and metrics.
npfl138.Tensor
module-attribute
Tensor: TypeAlias = Tensor | PackedSequence
A type alias for a single tensor or a packed sequence of tensors.
npfl138.TensorOrTensors
module-attribute
TensorOrTensors: TypeAlias = (
Tensor | tuple[Tensor, ...] | list[Tensor] | dict[str, Tensor] | Any
)
A type alias for a single tensor or a tensor structure.
While a tensor or a sequence of them is the most common, any type is allowed here to accommodate nested or completely custom data structures.