This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Simple example of manually performing "automatic" differentiation | |
""" | |
import numpy as np | |
from numpy import exp, sin, cos | |
def f(x, with_grad=False): | |
# Need to cache intermediates from forward pass (might not use all of them). | |
a = exp(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Freezing a stable-baselines to a frozen protocol buffer file to be served. | |
https://github.com/hill-a/stable-baselines | |
Some code taken from this lovely blog series | |
https://blog.metaflow.fr/tensorflow-how-to-freeze-a-model-and-serve-it-with-a-python-api-d4f3596b3adc | |
''' | |
import tensorflow as tf | |
import os |
NewerOlder