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
""" | |
Helper functions to save git information every time you | |
Requirements: | |
- GitPython==2.1.12 | |
(Probably works on other GitPython versions, but this is the version I've tested.) | |
Usage: | |
``` |
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
import PIL.Image | |
from io import BytesIO | |
from IPython.display import display, Image | |
import numpy as np | |
def show_img(a, fmt='png'): | |
# https://stackoverflow.com/questions/19471814/display-multiple-images-in-one-ipython-notebook-cell | |
a = np.uint8(a) | |
f = BytesIO() | |
PIL.Image.fromarray(a).save(f, fmt) |
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
import tensorflow as tf | |
LAYER_NORM_BIAS_DEFAULT_NAME = "ln_bias" | |
LAYER_NORM_GAIN_DEFAULT_NAME = "ln_gain" | |
LAYER_NORMALIZATION_DEFAULT_NAME = "layer_normalization" | |
def layer_normalize( | |
input_pre_nonlinear_activations, | |
input_shape, | |
epsilon=1e-5, |
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
""" | |
Author: Vitchyr Pong | |
Convert a PDF to svg files. Note that this is pretty slow since it makes | |
subprocess calls to inkscape's PDF-to-SVG command line convert. | |
Requirements: | |
- Inkscape (https://inkscape.org/) | |
- pyPdf (http://pybrary.net/pyPdf/) | |
- A '/tmp' directory. If not, you must pass in another directory. |