Skip to content

Instantly share code, notes, and snippets.

@paulgradie
paulgradie / bnlstm.py
Created July 6, 2017 05:41 — forked from spitis/bnlstm.py
Batch normalized LSTM Cell for Tensorflow
"""adapted from https://github.com/OlavHN/bnlstm to store separate population statistics per state"""
import tensorflow as tf, numpy as np
RNNCell = tf.nn.rnn_cell.RNNCell
class BNLSTMCell(RNNCell):
'''Batch normalized LSTM as described in arxiv.org/abs/1603.09025'''
def __init__(self, num_units, is_training_tensor, max_bn_steps, initial_scale=0.1, activation=tf.tanh, decay=0.95):
"""
* max bn steps is the maximum number of steps for which to store separate population stats
"""
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paulgradie
paulgradie / reference_formatter_50.py
Created August 18, 2014 01:41
Outdated Version: For making all your reference chromosome files evenly formatted to lines of 50bp PRIOR to concatenation.
__author__ = 'Paul G'
from sys import argv
import os
import re
script = argv
print """\nHi USER (lol Tron joke!) This simple script is meant to help you format your reference file.\n
It is really only meant to handle one chromosome file at a time,a future update will allow for entire reference fix.