Mercurial > pylearn
comparison _test_nnet_ops.py @ 286:2ee53bae9ee0
renamed _nnet_ops.py to _test_nnet_opt.py to be used with autotest
author | Frederic Bastien <bastienf@iro.umontreal.ca> |
---|---|
date | Fri, 06 Jun 2008 13:55:59 -0400 |
parents | _nnet_ops.py@3ef569b92fba |
children | 43d9aa93934e |
comparison
equal
deleted
inserted
replaced
285:23981827b794 | 286:2ee53bae9ee0 |
---|---|
1 | |
2 import unittest | |
3 import theano._test_tensor as TT | |
4 import numpy | |
5 | |
6 from nnet_ops import * | |
7 | |
8 class T_sigmoid(unittest.TestCase): | |
9 def setUp(self): | |
10 numpy.random.seed(9999) | |
11 def test_elemwise(self): | |
12 TT.verify_grad(self, sigmoid, [numpy.random.rand(3,4)]) | |
13 | |
14 class T_softplus(unittest.TestCase): | |
15 def setUp(self): | |
16 numpy.random.seed(9999) | |
17 def test_elemwise(self): | |
18 TT.verify_grad(self, softplus, [numpy.random.rand(3,4)]) | |
19 | |
20 class T_CrossentropySoftmax1Hot(unittest.TestCase): | |
21 def setUp(self): | |
22 numpy.random.seed(9999) | |
23 def test0(self): | |
24 y_idx = [0,1,3] | |
25 class Dummy(object): | |
26 def make_node(self, a,b): | |
27 return crossentropy_softmax_1hot_with_bias(a, b, y_idx)[0:1] | |
28 TT.verify_grad(self, Dummy(), [numpy.random.rand(3,4), | |
29 numpy.random.rand(4)]) | |
30 | |
31 def test1(self): | |
32 y_idx = [0,1,3] | |
33 class Dummy(object): | |
34 def make_node(self, a): | |
35 return crossentropy_softmax_1hot(a, y_idx)[0:1] | |
36 TT.verify_grad(self, Dummy(), [numpy.random.rand(3,4)]) | |
37 | |
38 | |
39 | |
40 if __name__ == '__main__': | |
41 unittest.main() |