The code grew organically as we tweaked more and more hyperparameters. Had I been more familiar with class-based declerations in TensorFlow (or embraded PyTorch sooner) the code would have been more elegant.
Environment
This code has been only tested with TensorFlow 1.8.0 and Python 3.5.4. The exact environment can be replicated by:
$ conda env create -f environment.yml
This would create a conda environment called studying-bnns.
Usage
$ conda activate studying-bnns# Run an experiment by passing args$ python run_with_args.py --model binary_connect_mlp
--dataset mnist --epochs 250 --batch-size 100
--binarization deterministic-binary# Run an experiment defined in a YAML filepython run_with_yaml.py some_experiment.yaml