Mercurial > pylearn
annotate _test_xlogx.py @ 526:242efecefd70
corrected import.
author | Frederic Bastien <bastienf@iro.umontreal.ca> |
---|---|
date | Fri, 14 Nov 2008 16:52:24 -0500 |
parents | 117e5b09cf31 |
children | 4e3629a894fa |
rev | line source |
---|---|
450 | 1 from xlogx import xlogx |
2 | |
3 import unittest | |
4 from theano import compile | |
5 from theano import gradient | |
6 | |
7 from theano.tensor import as_tensor | |
526
242efecefd70
corrected import.
Frederic Bastien <bastienf@iro.umontreal.ca>
parents:
450
diff
changeset
|
8 import theano.tensor.basic as TT |
450 | 9 |
10 import random | |
11 import numpy.random | |
12 | |
13 class T_XlogX(unittest.TestCase): | |
14 def test0(self): | |
15 x = as_tensor([1, 0]) | |
16 y = xlogx(x) | |
17 y = compile.eval_outputs([y]) | |
18 self.failUnless(numpy.all(y == numpy.asarray([0, 0.]))) | |
19 def test1(self): | |
20 class Dummy(object): | |
21 def make_node(self, a): | |
22 return [xlogx(a)[:,2]] | |
23 TT.verify_grad(self, Dummy(), [numpy.random.rand(3,4)]) | |
24 | |
25 | |
26 if __name__ == '__main__': | |
27 unittest.main() |