Skip to content Skip to sidebar Skip to footer

Creating A Custom Gradient Function For Hmc For Large Datasets

I'm trying to infer the parameters of a Gaussian process using HMC in tensorflow-probability. I have multiple independent data sequences that are generated from the same underlyin

Solution 1:

In case anyone is interested, I was able to solve this by using a custom gradient and stopping the tape recording in the for loop. I needed to import the tape utilities:

from tensorflow.python.eagerimport tape

then stop recording around the for loop

with tape.stop_recording():
    for i inrange(N):
        ...

This stops tracing, I then have to compute the gradient in graph mode and add them manually to stop the OOM error.

Post a Comment for "Creating A Custom Gradient Function For Hmc For Large Datasets"