Custom Tensorflow optimizer cSGLD (Stochastic Langevin Dynamics) in TF2: correct update ops? #48913
Labels
comp:ops
OPs related issues
stat:awaiting tensorflower
Status - Awaiting response from tensorflower
TF 2.2
Issues related to TF 2.2
type:feature
Feature requests
System information
Have I written custom code (as opposed to using a stock example script provided in TensorFlow): yes
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
TensorFlow installed from (source or binary): binary
TensorFlow version (use command below): v2.2
Python version: 3.6.9
CUDA/cuDNN version: v10.2
GPU model and memory: GeForce GTX 1070 - 8117MiB
Describe the current behavior:
I implemented Cyclical Stochastic Gradient MCMC for Bayesian Deep Learning as a custom optimizer in TF2. While it does run, I am not exactly sure about my implementation since the documentation for Tensorflow optimizers is almost non-existent... I would appreciate any help!
For your reference the pytorch implementation (WAY simpler) is here: https://github.com/ruqizhang/csgmcmc/blob/master/experiments/cifar_csgmcmc.py
Describe the bug
It's not so much a bug, rather asking advice on how to implement the noisy update in TF2 for stochastic gradient langevin dynamics without preconditioning. In Addons there is the TF1 only example of preconditioned SGLD, whereas I want to make it work for TF2.
Code to reproduce the issue
See the implementation with a running example here:
https://colab.research.google.com/drive/16kwhGfiat-SkK0RWvf4EADZC_FDVudL8?usp=sharing
If you use momentum (i.e. alpha < 1), then the implementation does not work.
I think the community would benefit from having access to this example (once working). Since there is no Tensorflow implementation yet of Cyclical Stochastic Gradient MCMC for Bayesian Deep Learning.
The text was updated successfully, but these errors were encountered: