comparison _nnet_ops.py @ 70:76e5c0f37165

better docs & precondition testing for cross_entropy_softmax_1hot & friends
author James Bergstra <bergstrj@iro.umontreal.ca>
date Fri, 02 May 2008 18:19:15 -0400
parents 8c2607f387e6
children 3ef569b92fba
comparison
equal deleted inserted replaced
69:8c2607f387e6 70:76e5c0f37165
21 def setUp(self): 21 def setUp(self):
22 numpy.random.seed(9999) 22 numpy.random.seed(9999)
23 def test0(self): 23 def test0(self):
24 y_idx = [0,1,3] 24 y_idx = [0,1,3]
25 def output1(a,b): 25 def output1(a,b):
26 return crossentropy_softmax_1hot(a, b, y_idx)[0:1] 26 return crossentropy_softmax_1hot_with_bias(a, b, y_idx)[0:1]
27 TT.verify_grad(self, output1, [numpy.random.rand(3,4), 27 TT.verify_grad(self, output1, [numpy.random.rand(3,4),
28 numpy.random.rand(4)]) 28 numpy.random.rand(4)])
29
30 def test1(self):
31 y_idx = [0,1,3]
32 def output1(a):
33 return crossentropy_softmax_1hot(a, y_idx)[0:1]
34 TT.verify_grad(self, output1, [numpy.random.rand(3,4)])
29 35
30 36
31 37
32 if __name__ == '__main__': 38 if __name__ == '__main__':
33 unittest.main() 39 unittest.main()