Skip to content

Instantly share code, notes, and snippets.

View lamblin's full-sized avatar

Pascal Lamblin lamblin

View GitHub Profile
@lamblin
lamblin / bug_softmax_crossentropy.py
Last active August 29, 2015 14:22
Non-lazy execution of ifelse
"""
Code by @mducoffe
Tested with:
- Blocks commit dea5cf31bedacb16c16d8fcc04a8c8205c6d9396
- Fuel commit a00fee301220a6ed80ed34a72b2d265bd0dc49f9
"""
import numpy as np
import theano
import theano.tensor as T
from blocks.bricks import Rectifier, Softmax, MLP, Identity
hidden value: (2, 3, 3)
[[[ 2.43871672e-316 4.07723682e-316 3.54132749e-312]
[ 1.62581115e-316 2.44505736e-316 2.36086774e-312]
[ 8.12905574e-317 -6.42364390e-319 1.18035621e-312]]
[[ 0.00000000e+000 8.19301551e-317 5.17748386e-317]
[ 8.12905574e-317 8.12877907e-317 1.18040798e-312]
[ 1.62581115e-316 2.44505736e-316 2.36086774e-312]]]
out value at step 0: (3, 3)
[[ 1. 1. 1.]