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}
}

Project details


Download files

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

Source Distribution

tfwn-1.0.1.tar.gz (5.0 kB view details)

Uploaded Source

File details

Details for the file tfwn-1.0.1.tar.gz.

File metadata

  • Download URL: tfwn-1.0.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for tfwn-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4572f44092a7ab4a2a2c452f57b5090de626d500d879b3e4c7cfbdaf5c13e0a5
MD5 e6f4c8dc45948c0fc8d2dc9109f8a4cb
BLAKE2b-256 bd5b98ac0c3b972f2550c5ce50c320ad65b14d70c38b5ec75f14bb504070ca0c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page