Other¶
Mean and variance online measures¶
|
Online sample mean aggregate. |
|
Online mean measure that updates 1d vector mean from a batch of vectors (2d tensor). |
Online sum measure. |
|
|
Keep track of population mean for each unique class label. |
|
Welford's online algorithm for population mean and variance estimation. |
|
Welford's online algorithm for population mean and variance estimation from batches of 1d vectors. |
Keep track of population mean and std for each unique class label. |
Data loader with simple API¶
|
Data loader with simple API. |
Inverse normalizations of data transforms¶
|
Undoes the normalization and returns reconstructed images in the input domain. |
|
Traverses the input transform, finds a class of |
|
Traverses the input transform and finds an instance of normalize_cls. |
|
Estimates dataset mean and std. |
Finding a layer¶
|
Find all layers of type layer_class in the input model and yield them as a generator. |
|
Find all layers of type layer_class in the input model and yield them as |
Working with batches¶
|
If the input is a tensor, return it. |
|
Transfers the batch to CUDA. |
|
Clones a tensor, followed by to CPU transfer. |
Miscellaneous¶
|
Sets the global seed for PyTorch, Numpy, and built-in random function. |
Layer hooks¶
|
Returns a list of ordered layers of the input model. |
Convert a model to the train or test mode¶
|
Stores the model state with its parameters to be restored later on. |
|
Sets the model and its parameters to the eval state. |
Signal processing and statistics¶
|
Exponential moving average in a sliding window. |
|
Computes the Peak signal-to-noise ratio between two signals. |
|
Compute L1 sparsity of the input tensor. |
Stubs¶
An Optimizer stub for trainers that update model weights in a gradient-free fashion. |
Constants¶
- mighty.utils.constants.BATCH_SIZE: int = 256¶
Default batch size.
- mighty.utils.constants.MIGHTY_DIR: str¶
Pytorch-mighty root directory. Defaults to
${HOME}/.mighty
.
- mighty.utils.constants.DATA_DIR: str¶
A directory with downloaded datasets. Defaults to
${HOME}/.mighty/data
.
- mighty.utils.constants.CHECKPOINTS_DIR: str¶
A directory with checkpoints. Defaults to
{HOME}/.mighty/checkpoints
.
- mighty.utils.constants.DUMPS_DIR: str¶
A directory with dumped layer activations. Defaults to
{HOME}/.mighty/dumps
.
- mighty.utils.constants.PCA_DIR: str¶
A directory with PCA pretrained instances that transforms layer activations to lower dimensions to be able to estimate Mutual Information. Defaults to
{HOME}/.mighty/pca
.
- mighty.utils.constants.VISDOM_LOGS_DIR: str¶
A directory with visdom logs, when a visdom server works in offline mode. Defaults to
{HOME}/.mighty/visdom_logs
.