Skip to content

Instantly share code, notes, and snippets.

View usernaamee's full-sized avatar
☄️
Optimistic Transpiler

usernaamee

☄️
Optimistic Transpiler
View GitHub Profile
@usernaamee
usernaamee / rwa.py
Created April 10, 2017 15:12 — forked from shamatar/rwa.py
Keras (keras.is) implementation of Recurrent Weighted Average, as described in https://arxiv.org/abs/1703.01253. Follows original implementation in Tensorflow from https://github.com/jostmey/rwa. Works with fixed batch sizes, requires "batch_shape" parameter in input layer. Outputs proper config, should save and restore properly. You are welcome…
from keras.layers import Recurrent
import keras.backend as K
from keras import activations
from keras import initializers
from keras import regularizers
from keras import constraints
from keras.engine import Layer
from keras.engine import InputSpec
@usernaamee
usernaamee / binfile2pycode.py
Created March 13, 2017 19:03
Create self extracting python 2.6+ source code from any binary file
"""
:|
- Email provider doesn't allow me to send certain file types.
- I have python installed on all my machines.
- Inflates the file size by ~4.5X, still remains under 25M for me.
"""
from __future__ import print_function
import sys
@usernaamee
usernaamee / MDN (Keras + Theano).py
Created December 9, 2016 10:54
mixture density network in theano + keras
import os
import theano
import numpy as np
import theano.tensor as T
from keras import backend as K
from keras.models import Sequential
from keras.layers.core import Layer, Dense, Lambda
def log_sum_exp(x, axis=None):
@usernaamee
usernaamee / 10102016.py
Created October 10, 2016 13:32
xt = alpha f + (1-alpha) e + const ? (var input frame size for f, alpha, e)? not lstm?
import sys
import librosa
import numpy as np
def normalize_audio(raw_audio):
minval = raw_audio.min()
maxval = raw_audio.max()
audio = (((raw_audio - minval) / float(maxval - minval)) - 0.5) * 2.0
return audio