提交 fb999ebc authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Fixes for python 2.4

上级 6d33775d
...@@ -1468,13 +1468,13 @@ class SpSumTester(utt.InferShapeTester): ...@@ -1468,13 +1468,13 @@ class SpSumTester(utt.InferShapeTester):
variable, data = sparse_random_inputs(format, variable, data = sparse_random_inputs(format,
shape=(10, 10)) shape=(10, 10))
z = theano.sparse.sp_sum(*variable, axis=axis) z = theano.sparse.sp_sum(variable[0], axis=axis)
if axis == None: if axis == None:
assert z.type.broadcastable == () assert z.type.broadcastable == ()
else: else:
assert z.type.broadcastable == (False, ) assert z.type.broadcastable == (False, )
f = theano.function(variable, self.op(*variable, axis=axis)) f = theano.function(variable, self.op(variable[0], axis=axis))
tested = f(*data) tested = f(*data)
expected = data[0].todense().sum(axis).ravel() expected = data[0].todense().sum(axis).ravel()
assert numpy.allclose(tested, expected) assert numpy.allclose(tested, expected)
...@@ -1485,7 +1485,7 @@ class SpSumTester(utt.InferShapeTester): ...@@ -1485,7 +1485,7 @@ class SpSumTester(utt.InferShapeTester):
variable, data = sparse_random_inputs(format, variable, data = sparse_random_inputs(format,
shape=(10, 10)) shape=(10, 10))
self._compile_and_check(variable, self._compile_and_check(variable,
[self.op(*variable, axis=axis)], [self.op(variable[0], axis=axis)],
data, data,
self.op_class) self.op_class)
......
...@@ -8,7 +8,7 @@ import numpy ...@@ -8,7 +8,7 @@ import numpy
from numpy.testing import dec from numpy.testing import dec
import theano import theano
from theano.gof.python25 import all from theano.gof.python25 import all, any
from theano.gof import Variable, Op from theano.gof import Variable, Op
from theano import gof, scalar, config from theano import gof, scalar, config
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论