Skip to content

Instantly share code, notes, and snippets.

View tawnkramer's full-sized avatar

Tawn Kramer tawnkramer

  • San Diego, CA
View GitHub Profile
@tawnkramer
tawnkramer / keras_quant.py
Created May 3, 2019 22:55 — forked from rocking5566/keras_quant.py
Quantization aware training in keras
import numpy as np
import tensorflow as tf
from tensorflow.keras.datasets import mnist
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Activation, Conv2D, Flatten
from tensorflow.keras.optimizers import RMSprop
# download the mnist to the path '~/.keras/datasets/' if it is the first time to be called
# X shape (60,000 28x28), y shape (10,000, )