Mercurial > pylearn
comparison simple_autoassociator.py/graph.py @ 388:98ca97cc9910
Debugging simple AA
author | Joseph Turian <turian@gmail.com> |
---|---|
date | Tue, 08 Jul 2008 17:41:26 -0400 |
parents | a474341861fa |
children |
comparison
equal
deleted
inserted
replaced
387:dace8b9743af | 388:98ca97cc9910 |
---|---|
12 w2 = t.dmatrix() | 12 w2 = t.dmatrix() |
13 b2 = t.dvector() | 13 b2 = t.dvector() |
14 h = sigmoid(dot(x, w1) + b1) | 14 h = sigmoid(dot(x, w1) + b1) |
15 y = sigmoid(dot(h, w2) + b2) | 15 y = sigmoid(dot(h, w2) + b2) |
16 | 16 |
17 loss = t.sum(binary_crossentropy(y, x)) | 17 loss_unsummed = binary_crossentropy(y, x) |
18 loss = t.sum(loss_unsummed) | |
18 | 19 |
19 (gw1, gb1, gw2, gb2) = t.grad(loss, [w1, b1, w2, b2]) | 20 (gw1, gb1, gw2, gb2) = t.grad(loss, [w1, b1, w2, b2]) |
20 | 21 |
21 import theano.compile | 22 import theano.compile |
22 | 23 |
23 inputs = [x, w1, b1, w2, b2] | 24 inputs = [x, w1, b1, w2, b2] |
24 outputs = [y, loss, gw1, gb1, gw2, gb2] | 25 outputs = [y, h, loss, loss_unsummed, gw1, gb1, gw2, gb2] |
25 trainfn = theano.compile.function(inputs, outputs) | 26 trainfn = theano.compile.function(inputs, outputs) |