Mercurial > pylearn
view _test_nnet_ops.py @ 324:ce79bf5fa463
- the cut and paste between file and dir conditions is always a bad thing
- i made one function (hg_version) to basically call and parse hg
- i made a function to include the cases of what might be returned by
imp.find_modules (_input_id)
- the check for a .hg folder was insufficient. Lots of things could go wrong.
Instead I use the return code from the Popen process. The return code
catches this and any other problem that hg runs into.
- its easier to offer more rcs support in future (cvs,svn,git)
author | James Bergstra <bergstrj@iro.umontreal.ca> |
---|---|
date | Thu, 12 Jun 2008 20:54:49 -0400 |
parents | 2ee53bae9ee0 |
children | 43d9aa93934e |
line wrap: on
line source
import unittest import theano._test_tensor as TT import numpy from nnet_ops import * class T_sigmoid(unittest.TestCase): def setUp(self): numpy.random.seed(9999) def test_elemwise(self): TT.verify_grad(self, sigmoid, [numpy.random.rand(3,4)]) class T_softplus(unittest.TestCase): def setUp(self): numpy.random.seed(9999) def test_elemwise(self): TT.verify_grad(self, softplus, [numpy.random.rand(3,4)]) class T_CrossentropySoftmax1Hot(unittest.TestCase): def setUp(self): numpy.random.seed(9999) def test0(self): y_idx = [0,1,3] class Dummy(object): def make_node(self, a,b): return crossentropy_softmax_1hot_with_bias(a, b, y_idx)[0:1] TT.verify_grad(self, Dummy(), [numpy.random.rand(3,4), numpy.random.rand(4)]) def test1(self): y_idx = [0,1,3] class Dummy(object): def make_node(self, a): return crossentropy_softmax_1hot(a, y_idx)[0:1] TT.verify_grad(self, Dummy(), [numpy.random.rand(3,4)]) if __name__ == '__main__': unittest.main()