提交 334081ee authored 作者: Tanjay94's avatar Tanjay94

Small fixes in tests.

上级 384b9e66
...@@ -45,7 +45,8 @@ from theano.tensor import (_shared, wvector, bvector, autocast_float_as, ...@@ -45,7 +45,8 @@ from theano.tensor import (_shared, wvector, bvector, autocast_float_as,
dtensor3, SpecifyShape, Mean, dtensor3, SpecifyShape, Mean,
itensor3, Tile, switch, Diagonal, Diag, itensor3, Tile, switch, Diagonal, Diag,
nonzero, flatnonzero, nonzero_values, nonzero, flatnonzero, nonzero_values,
stacklists, DimShuffle, hessian, ptp, power) stacklists, DimShuffle, hessian, ptp, power,
swapaxes)
from theano.tests import unittest_tools as utt from theano.tests import unittest_tools as utt
...@@ -6898,21 +6899,22 @@ if __name__ == '__main__': ...@@ -6898,21 +6899,22 @@ if __name__ == '__main__':
t.setUp() t.setUp()
t.test_infer_shape() t.test_infer_shape()
class T_swapaxesbadinput(unittest.TestCase): class T_swapaxes(unittest.TestCase):
def test_no_dimensional_input(self): def test_no_dimensional_input(self):
self.assertRaises(IndexError, Axes.swapaxes, 2,0,1) self.assertRaises(IndexError, swapaxes, 2,0,1)
def test_unidimensional_input(self): def test_unidimensional_input(self):
self.assertRaises(IndexError, Axes.swapaxes, [2,1],0,1) self.assertRaises(IndexError, swapaxes, [2,1],0,1)
def test_not_enough_dimension(self): def test_not_enough_dimension(self):
self.assertRaises(IndexError, Axes.swapaxes, [[2,1],[3,4]], 3, 4) self.assertRaises(IndexError, swapaxes, [[2,1],[3,4]], 3, 4)
def test_doubleswap(self): def test_doubleswap(self):
y = matrix() y = matrix()
n = Axes.swapaxes(y,0,1) n = swapaxes(y,0,1)
f = function([y], n) f = function([y], n)
testMatrix = [[2,1],[3,4]] testMatrix = [[2,1],[3,4]]
self.assertTrue(numpy.array_equal(testMatrix,f(f(testMatrix)))) self.assertTrue(numpy.array_equal(testMatrix,f(f(testMatrix))))
class T_Power(): class T_Power():
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论