Skip to content

Instantly share code, notes, and snippets.

Ludwig Schmidt-Hackenberg shackenberg

Block or report user

Report or block shackenberg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@shackenberg
shackenberg / forward.py
Created Sep 9, 2013
Profile results for forward function in Theano using scan
View forward.py
from numpy import zeros, dot, exp, tanh, array, allclose
from numpy.random import randn
from copy import deepcopy
from time import time
from theano import tensor as T
from theano import function, shared, config, scan
FLOAT_PRECISION = config.floatX
class Network:
View minimal.rnn.theano.py
import numpy
import theano
import theano.tensor as TT
# number of hidden units
n = 50
# number of input units
nin = 5
# number of output units
nout = 5
@shackenberg
shackenberg / minimal.forward.example.theano.py
Last active Dec 21, 2015
Comparison of a forward function written in theano with the numpy version.
View minimal.forward.example.theano.py
from numpy import zeros, dot, exp, tanh, array, allclose
from numpy.random import randn
from copy import deepcopy
from time import time
from theano import tensor as T
from theano import function, shared, config
"""Flags:
export THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32
View result.nosetest.theano.addingGpuJoin.c_code
ludwig@serv8:~/Theano$ theano-nose -v
/home/ludwig/Theano/theano/misc/pycuda_init.py:34: UserWarning: PyCUDA import failed in theano.misc.pycuda_init
warnings.warn("PyCUDA import failed in theano.misc.pycuda_init")
Using gpu device 0: GeForce GTX 670
test_grad (theano.compile.tests.test_builders.T_OpFromGraph) ... ok
test_size_changes (theano.compile.tests.test_builders.T_OpFromGraph) ... ok
test_straightforward (theano.compile.tests.test_builders.T_OpFromGraph) ... ok
test_aliased_outputs_bad (theano.compile.tests.test_debugmode.Test_ViewMap) ... ok
test_aliased_outputs_ok (theano.compile.tests.test_debugmode.Test_ViewMap) ... ok
test_aliased_outputs_ok_output (theano.compile.tests.test_debugmode.Test_ViewMap) ... ok
View theano.test().output.0.6.0rc3
>>> theano.test()
Theano version 0.6.0rc3
theano is installed in /usr/local/lib/python2.7/dist-packages/theano
NumPy version 1.6.1
NumPy is installed in /usr/lib/python2.7/dist-packages/numpy
Python version 2.7.3 (default, Aug 1 2012, 05:14:39) [GCC 4.6.3]
nose version 1.1.2
Using gpu device 0: GeForce GTX 670
.........................................K.............../usr/local/lib/python2.7/dist-packages/theano/compile/tests/test_inplace_opt_for_value.py:170: UserWarning: theano modules are deprecated and will be removed in release 0.7
super(ExampleRNN, self).__init__()
View GpuJoin.c_code %(fail)s error
THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32,exception_verbosity=high python jointest.py
Using gpu device 0: Quadro FX 580
WARNING (theano.sandbox.cuda): You are probably using an old GPU, that Theano does not support. This means GPU code will most likely be slow AND may crash when we try to use features that your GPU does not support.
1 #include <Python.h>
2 #include <iostream>
3 #include <numpy/arrayobject.h>
4 #include <math.h>
5 #include <numpy/arrayscalars.h>
6 #include "cuda_ndarray.cuh"
7 //////////////////////
View GpuJoin.c_code.test.py
#!/usr/bin/env python
"""
call this to run the code:
export CUDA_LAUNCH_BLOCKING=1
THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32,exception_verbosity=high python jointest.py
"""
import theano
import theano.tensor as T
from numpy import *
@shackenberg
shackenberg / TimelineSpammers.py
Created Dec 6, 2012
Script to find the twitterer who are responsible for the most tweets in your timeline
View TimelineSpammers.py
from collections import Counter
from twython import Twython
import operator
app_key = 'XXX'
app_secret = 'XXX'
## init OAuth
t = Twython(app_key=app_key,
app_secret=app_secret)
@shackenberg
shackenberg / soupdownloader.py
Created Sep 19, 2012
soup.io image downloader / backup script
View soupdownloader.py
import feedparser
import urllib
d = feedparser.parse(XXX) # link to the soup.io rss feed
PATH = 'old_soup/'
print len(d.entries)
for entry in d.entries:
print entry['links'][0]['href']
if entry['links'][0]['type'] == u'image/jpeg':
@shackenberg
shackenberg / pbar
Last active Oct 10, 2015
super minimal progress bar (Python)
View pbar
Code now at https://github.com/shackenberg/pbar.py
You can’t perform that action at this time.