Network Moments is a toolkit that enables computing some probabilistic moments of deep neural networks given a specific input distribution. The current implemetation allows you to compute the first and second Gaussian network moments (GNM) of affine-ReLU-affine networks i.e., the output mean and variance subject to Gaussian input.
The main backend framework is but also and are supported.
Network Moments was developed and tested with the following:
- Python v3.6.3+
- Option 1:
PyTorch
- torch v0.4.0+
- (Optional) torchvision v0.2.1+
- Option 2:
TensorFlow
- numpy v1.14.2+
- tensorflow v1.8.0+
- Option 3:
MatLab
- matlab vR2017b+
You need Jupyter to run tightness. It is recommended that you have Jupyter Lab.
After installing the requirements, to install or update this package run the following in the terminal:
pip install -U git+https://github.com/ModarTensai/network_moments.git
Now go to the tightness notebook to see how to use this tool with the default backend framework.
To uninstall the package:
pip uninstall network_moments
To import the PyTorch
sub-package:
import network_moments.torch as nm
The basic usage is demonstrated in the tightness notebook.
To import the TensorFlow
sub-package:
import network_moments.tensorflow as nm
Please, refer to tensorflow tests notebook for examples to compare PyTorch
and TensorFlow
implementations.
This is the official implementation of the method described in this paper (checkout the poster):
@InProceedings{Bibi_2018_CVPR,
author = {Bibi, Adel and Alfadly, Modar and Ghanem, Bernard},
title = {Analytic Expressions for Probabilistic Moments of PL-DNN With Gaussian Input},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2018}
}
MIT
I would gladly accept any pull request that improves any aspect of this repository.