Skip to main content

Weight normalization layer for TensorFlow

Project description

tfwn

Weight Normalization layer wrapper for TensorFlow-Keras API.

Inspired by Sean Morgan implementation, but:

  • No data initialization (only eager mode was implemented in original pull request).
  • Code refactoring
  • More tests
  • CIFAR10 example from original paper reimplemented

Examples

Unfortunately I couldn't reproduce parer results on CIFAR10 with batch size 100. As you can see there is no much difference in accuracy.

But with much smaller batch size model with weight normalization is much better then regular one.

How to use

import tensorflow as tf
from tfwn import WeightNorm


dense_wn = WeightNorm(tf.keras.layers.Dense(3))
out = dense_wn(input)

References

Weight Normalization: A Simple Reparameterization to Accelerate Training of Deep Neural Networks

Tim Salimans, and Diederik P. Kingma.

@inproceedings{Salimans2016WeightNorm,
  title={Weight Normalization: A Simple Reparameterization to Accelerate Training of Deep Neural Networks},
  author={Tim Salimans and Diederik P. Kingma},
  booktitle={Neural Information Processing Systems 2016},
  year={2016}
}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tfwn, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size tfwn-1.0.1.tar.gz (5.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page