Types#

Type Aliases#

Param#

Alias of dict[str, Tensor | Param]

DataLike#

Alias of ndarray | Tensor | Data[ArrayCT]

ShapeLike#

Alias of list[int] | list[list[int]]

ArrayLike#

Alias of ndarray | Tensor

TensorLike#

Alias of Tensor | Data[Tensor] | DataList[Tensor | Data[Tensor]]

NDArrayLike#

Alias of ndarray | Data[ndarray] | DataList[ndarray | Data[ndarray]]

DataListLike#

Alias of ndarray | Tensor | Data[ArrayCT] | DataList[ndarray | Tensor | Data[ArrayCT]]

TensorListLike#

Alias of Tensor | DataList[Tensor]

NDArrayListLike#

Alias of ndarray | DataList[ndarray]

Type Variables#

P#

ParamSpec

T#

TypeVar

DataT#

TypeVar[bound = ndarray | Tensor | Data[ArrayCT]]

ArrayT#

TypeVar[bound = ndarray | Tensor]

ModuleT#

TypeVar[bound = Module]

TensorT#

TypeVar[bound = Tensor | Data[Tensor] | DataList[Tensor | Data[Tensor]]]

NDArrayT#

TypeVar[bound = ndarray | Data[ndarray] | DataList[ndarray | Data[ndarray]]]

DatasetT#

TypeVar[bound = DatasetProtocol]

DataListT#

TypeVar[bound = ndarray | Tensor | Data[ArrayCT] | DataList[ndarray | Tensor | Data[ArrayCT]]]

TensorListT#

TypeVar[bound = Tensor | DataList[Tensor]]

ModuleListT#

TypeVar[bound = Module | ModuleList]

ArrayCT#

TypeVar[ndarray, Tensor]

LossCT#

TypeVar[float, dict[str, float]]

TensorLossCT#

TypeVar[Tensor, dict[str, Tensor]]

Protocols#

class DatasetProtocol(*args, **kwargs)[source]#

Bases: Protocol[DataT]

Protocol for datasets used in NetLoader

Attributes:
extralist[Any] | ndarray | NoneType

Additional data for each sample in the dataset of length N with shape (N,…) and type Any

idxsndarray

Index for each sample in the dataset with shape (N) and type int

low_dimndarray | Tensor | NoneType

Low dimensional data for each sample in the dataset with shape (N)

high_dimndarray | Tensor | object

High dimensional data for each sample in the dataset with shape (N), this is required

__getitem__(idx)[source]#
Parameters:
idxint

Sample index

Returns:
tuple[int, DataListT, DataListT, Any]

Sample index, low dimensional data, high dimensional data, and extra data

__len__()[source]#

Returns the number of samples in the dataset

Returns:
int

Number of samples in the dataset

step(epoch)[source]#

Step the dataset for each training iteration.

Parameters:
epochfloat

Current epoch number