comparison _nnet_ops.py @ 30:bf0145fa73e8

added c implementation for CrossentropySoftmax1Hot
author bergstrj@iro.umontreal.ca
date Fri, 11 Apr 2008 21:41:09 -0400
parents b63e8c0bf21b
children 8c2607f387e6
comparison
equal deleted inserted replaced
27:e6c550cb2896 30:bf0145fa73e8
15 class T_CrossentropySoftmax1Hot(unittest.TestCase): 15 class T_CrossentropySoftmax1Hot(unittest.TestCase):
16 def setUp(self): 16 def setUp(self):
17 numpy.random.seed(9999) 17 numpy.random.seed(9999)
18 def test0(self): 18 def test0(self):
19 y_idx = [0,1,3] 19 y_idx = [0,1,3]
20 def output1(a): 20 def output1(a,b):
21 return crossentropy_softmax_1hot(a, y_idx)[0:1] 21 return crossentropy_softmax_1hot(a, b, y_idx)[0:1]
22 TT.verify_grad(self, output1, [numpy.random.rand(3,4)]) 22 TT.verify_grad(self, output1, [numpy.random.rand(3,4),
23 numpy.random.rand(4)])
23 24
24 25
25 26
26 if __name__ == '__main__': 27 if __name__ == '__main__':
27 unittest.main() 28 unittest.main()