Skip to content

Instantly share code, notes, and snippets.

View sisp's full-sized avatar
🏠
Working from home

Sigurd Spieckermann sisp

🏠
Working from home
View GitHub Profile
diff --git a/theano/tensor/basic.py b/theano/tensor/basic.py
index 8f734e2..52327a6 100644
--- a/theano/tensor/basic.py
+++ b/theano/tensor/basic.py
@@ -3804,6 +3804,202 @@ def vertical_stack(*args):
return concatenate(args, axis=0)
+class FixUnknownDimension(Op):
+ """Infer an unknown dimension indicated by `-1`.
@sisp
sisp / nnet.py.diff
Created February 24, 2015 13:59
CrossentropySoftmax1HotWithBiasDx + local_useless_incsubtensor_alloc
diff --git a/theano/tensor/nnet/nnet.py b/theano/tensor/nnet/nnet.py
index 788213d..e468385 100644
--- a/theano/tensor/nnet/nnet.py
+++ b/theano/tensor/nnet/nnet.py
@@ -1099,7 +1099,7 @@ class CrossentropySoftmax1HotWithBiasDx (gof.Op):
return [g_dy, g_sm, g_y_idx]
def c_code_cache_version(self):
- return (3,)
+ return (4,)
@sisp
sisp / template_op
Last active August 29, 2015 14:10
Conceptual example of how to use template ops
class TemplateOp(theano.Op):
@property
def __impls__(self):
return {}
def __call__(self, *inputs, **kwargs):
tag = kwargs.pop('tag', None)
if tag is None:
return super(TemplateOp, self).__call__(*inputs, **kwargs)
import theano
import theano.tensor as T
import numpy as np
def step(b, a, x, t, W):
y = theano.dot(x[a:b], W)
y = theano.printing.Print()(y)
error = 0.5 * T.sqr(t[a:b] - y).sum()
return b, error
@sisp
sisp / scan_missing_inputs_v2.py
Last active December 26, 2015 18:39
This is the output I get for the two function calls. [-3.11292315 -2.80163074 -2.52146769 -2.26932096 -2.04238892 -1.83815002 -1.65433502 -1.4889015 -1.34001136 -1.20601022] Traceback (most recent call last): File "test_scan.py", line 52, in <module> run(y, dy_dw, w, None, givens, scan) # doesn't work File "test_scan.py", line 36, in run rval, u…
import numpy as np
import theano
import theano.tensor as T
floatX = theano.config.floatX
def scan(y, dy_dw, w, x):
def step(dy_dw_, y_, w_, a_, *x_):
import numpy as np
import theano
import theano.tensor as T
floatX = theano.config.floatX
def scan1(a, y, x=None):
"""
@sisp
sisp / gist:7100561
Created October 22, 2013 13:15
ERROR (theano.gof.opt): Optimization failure due to: remove_constants_and_unused_inputs_scan ERROR (theano.gof.opt): TRACEBACK: ERROR (theano.gof.opt): Traceback (most recent call last): File "/home/sigurd/.local/lib/python2.7/site-packages/Theano-0.6.0rc3-py2.7.egg/theano/gof/opt.py", line 1216, in process_node replacements = lopt.transform(nod…
import numpy as np
import theano
import theano.tensor as T
floatX = theano.config.floatX
class GaussNewtonMatrix(object):
def __init__(self, s):