Mercurial > pylearn
view _test_onehotop.py @ 672:27b1344a57b1
Added preprocessing back in
author | Joseph Turian <turian@gmail.com> |
---|---|
date | Thu, 20 Nov 2008 06:38:06 -0500 |
parents | 844bad76459c |
children |
line wrap: on
line source
from onehotop import one_hot import unittest from theano import compile from theano import gradient from theano import function from theano.tensor import as_tensor import random import numpy.random class T_OneHot(unittest.TestCase): def test0(self): x = as_tensor([3, 2, 1]) y = as_tensor(5) o = one_hot(x, y) f = function([],o) self.failUnless(numpy.all(f() == numpy.asarray([[0, 0, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 0, 0]]))) if __name__ == '__main__': unittest.main()