view _nnet_ops.py @ 99:a8da709eb6a9

in ArrayDataSet.__init__ if a columns is an index, we change it to be a list that containt only this index. This way, we remove the special case where the columns is an index for all subsequent call. This was possing trouble with numpy.vstack() called by MinibatchWrapAroundIterator.next
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Tue, 06 May 2008 13:57:36 -0400
parents 76e5c0f37165
children 3ef569b92fba
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]
        def output1(a,b):
            return crossentropy_softmax_1hot_with_bias(a, b, y_idx)[0:1]
        TT.verify_grad(self, output1, [numpy.random.rand(3,4),
            numpy.random.rand(4)])

    def test1(self):
        y_idx = [0,1,3]
        def output1(a):
            return crossentropy_softmax_1hot(a, y_idx)[0:1]
        TT.verify_grad(self, output1, [numpy.random.rand(3,4)])



if __name__ == '__main__':
    unittest.main()