Skip to content

Instantly share code, notes, and snippets.

Avatar

Szymon Sidor siemanko

View GitHub Profile
View codenames.html
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<style>
body {
padding-top: 70px;
}
.cards {
vertical-align: middle;
View initialization_trouble.py
import argparse
import numpy as np
import tensorflow as tf
from tensorflow.python.framework.errors import FailedPreconditionError
"""Code for data dependent initialization in Weight Normalization paper:
https://arxiv.org/abs/1602.07868
"""
@siemanko
siemanko / my_lstm_cell.py
Last active Apr 21, 2020
Simplified version of LSTM cell. Adds an option to learn zero_state
View my_lstm_cell.py
class MyLSTMCell(tf.nn.rnn_cell.RNNCell):
"""Simplified Version rnn_cell.BasicLSTMCell"""
def __init__(self, num_units):
super(MyLSTMCell, self).__init__()
self._num_units = num_units
def __call__(self, inputs, state, scope="LSTM"):
with tf.variable_scope(scope):
c, h = state
@siemanko
siemanko / tf_lstm.py
Last active Jun 3, 2020
Simple implementation of LSTM in Tensorflow in 50 lines (+ 130 lines of data generation and comments)
View tf_lstm.py
"""Short and sweet LSTM implementation in Tensorflow.
Motivation:
When Tensorflow was released, adding RNNs was a bit of a hack - it required
building separate graphs for every number of timesteps and was a bit obscure
to use. Since then TF devs added things like `dynamic_rnn`, `scan` and `map_fn`.
Currently the APIs are decent, but all the tutorials that I am aware of are not
making the best use of the new APIs.
Advantages of this implementation:
You can’t perform that action at this time.