Skip to content

Instantly share code, notes, and snippets.

View crypt3lx2k's full-sized avatar
💯

Truls Edvard Stokke crypt3lx2k

💯
View GitHub Profile
#! /usr/bin/env python3
"""Downloads pdfs from David Silver's publications directory."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import re
import time
@crypt3lx2k
crypt3lx2k / 0-model.py
Last active September 2, 2021 07:59
Training model in tensorflow for tflite with 8-bit integer quantization
#! /usr/bin/env python
import tensorflow as tf
def inference_fn(x, training=False):
net = x
net = tf.layers.flatten(net)
net = tf.layers.dense(net, 512, activation=tf.nn.relu)
net = tf.layers.dropout(net, 0.2, training=training)
@crypt3lx2k
crypt3lx2k / 1-train.py
Last active November 9, 2018 17:21
Training and exporting a keras model to the TFLite format
#! /usr/bin/env python
import tensorflow as tf
mnist = tf.keras.datasets.mnist
(x_train, y_train),(x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0
model = tf.keras.models.Sequential([
tf.keras.layers.Flatten(input_shape=(28, 28)),