Skip to content

Instantly share code, notes, and snippets.

View fanannan's full-sized avatar

SAWADA Takahiro / Gugen Koubou LLC fanannan

  • Gugen Koubou LLC
  • Tokyo, Japan
View GitHub Profile
@fanannan
fanannan / keras.py
Last active December 16, 2015 02:09 — forked from hnykda/keras.py
Tada's usage (see discussion)
""" From: http://danielhnyk.cz/predicting-sequences-vectors-keras-using-rnn-lstm/
and https://gist.github.com/hnykda/f1eca6cb0061cde701c2#file-keras-py
See comments on the blog at danielhnyk.cz. """
from keras.models import Sequential
from keras.layers.core import TimeDistributedDense, Dense, Activation, Dropout
from keras.layers.recurrent import GRU, LSTM
import numpy as np
import datetime
import matplotlib.pyplot as plt
try:
@fanannan
fanannan / peephole_lstm.py
Created December 16, 2015 02:50 — forked from ShigekiKarita/peephole_lstm.py
Peephole connected LSTM in chainer
import numpy
import six
from chainer import cuda
from chainer import function
from chainer.utils import type_check
def _extract_gates(x):
r = x.reshape((x.shape[0], x.shape[1] / 3, 3) + x.shape[2:])