Skip to content

Instantly share code, notes, and snippets.


Quim Llimona lemonzi

View GitHub Profile
lemonzi /
Created Apr 24, 2017
Unit testing the A3C algorithm
import tensorflow as tf
from tensorflow.contrib import distributions
# These are your input features, a random tensor.
# There are 128 examples per batch, 1000 time-steps, one observation.
# If your code doesn't use batches, remove the first dimension.
features = tf.random_normal([128, 1000, 1])
# Put your networks here
# policy_mu, policy_sigma = ...
lemonzi /
Created Mar 13, 2017
TensorFlow implementation of an Advantage Actor-Critic loss
import numpy as np
import scipy.signal
import tensorflow as tf
import tensorify
def discount(x, gamma=1.0, axis=0):
y = scipy.signal.lfilter([1], [1, -gamma], x[::-1], axis=axis)[::-1]
return y.astype(np.float32)
lemonzi /
Last active Feb 17, 2017
@add_name_scope() decorator for TensorFlow
"""Decorators that make TensorFlow programming a bit easier.
Quim Llimona, 2017.
import functools
import tensorflow as tf
def add_name_scope(name=None):
"""Creates a name_scope that contains all ops created by the function.
lemonzi /
Created May 24, 2014
Sphero-osc setup
git clone
cd sphero-osc
npm install
# This is for running it
node .