comparison _test_xlogx.py @ 450:117e5b09cf31

Added an XlogX op.
author Joseph Turian <turian@gmail.com>
date Thu, 04 Sep 2008 14:46:17 -0400
parents
children 242efecefd70
comparison
equal deleted inserted replaced
449:2bb67e978c28 450:117e5b09cf31
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
8 import theano._test_tensor as TT
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()