def test_equality_case(self):
"""
Test assuring normal behaviour when values
in the matrices are equal
"""
scipy_ver = [int(n) for n in scipy.__version__.split('.')[:2]]
if (bool(scipy_ver < [0, 13])):
raise SkipTest("comparison operators need newer release of scipy")
x = sparse.csc_matrix()
y = theano.tensor.matrix()
m1 = sp.csc_matrix((2, 2), dtype=theano.config.floatX)
m2 = numpy.asarray([[0, 0], [0, 0]], dtype=theano.config.floatX)
for func in self.testsDic:
op = func(y, x)
f = theano.function([y, x], op)
self.assertTrue(numpy.array_equal(f(m2, m1),
self.testsDic[func](m2, m1)))
评论列表
文章目录