Skip to content

Instantly share code, notes, and snippets.

@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)
@EndingCredits
EndingCredits / adamirror.py
Last active November 14, 2019 09:26
Quick and dirty tensorflow implementation of Optimistic Mirror Descent for the Adam Optimiser as in https://arxiv.org/abs/1711.00141
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import state_ops
from tensorflow.python.framework import ops
from tensorflow.python.training import optimizer
import tensorflow as tf
@dfa1234
dfa1234 / XORCipher.ts
Last active July 30, 2023 20:39 — forked from sukima/XORCipher.js
A Super simple encryption cipher using XOR and Base64 in JavaScript - Just made the typescript version for angular 4, and I removed the underscore dependency
// XORCipher - Super simple encryption using XOR and Base64
// Usage
// --------
//
// XORCipher.encode("test", "foobar"); // => "EgocFhUX"
// XORCipher.decode("test", "EgocFhUX"); // => "foobar"
//
// Copyright © 2013 Devin Weaver <suki@tritarget.org>
//
// This program is free software. It comes without any warranty, to
@shagunsodhani
shagunsodhani / Conditional Generative Adversarial Nets.md
Last active November 5, 2019 17:54
Summary of "Conditional Generative Adversarial Nets" Paper

Conditional Generative Adversarial Nets

Introduction

Architecture

  • Feed y into both the generator and discriminator as additional input layers such that y and input are combined in a joint hidden representation.
@wiseodd
wiseodd / gan.py
Last active September 1, 2020 10:22
Generative Adversarial Nets (GAN) implementation in TensorFlow using MNIST Data.
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import os
def xavier_init(size):
in_dim = size[0]
@MateoV
MateoV / difference.js
Created August 4, 2015 19:18
Use Tile Reduce and OSM QA Tiles to find the difference between OSM roads and Tiger roads
var turf = require('turf'),
flatten = require('geojson-flatten'),
normalize = require('geojson-normalize'),
tilebelt = require('tilebelt');
module.exports = function(tileLayers, tile, done) {
// concat feature classes and normalize data
var tigerRoads = normalize(tileLayers.tiger.tiger20062014);
var osmData = normalize(tileLayers.osmdata.migeojson);