提交 96b7c725 authored 作者: nouiz's avatar nouiz

Merge pull request #805 from lamblin/fix_py24

Fixes for python 2.4
...@@ -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
...@@ -673,7 +673,7 @@ class T_mean_dtype(unittest.TestCase): ...@@ -673,7 +673,7 @@ class T_mean_dtype(unittest.TestCase):
if sum_dtype in tensor.discrete_dtypes: if sum_dtype in tensor.discrete_dtypes:
assert mean_var.dtype == 'float64', (mean_var.dtype, sum_dtype) assert mean_var.dtype == 'float64', (mean_var.dtype, sum_dtype)
else: else:
assert mean_var.dtype == sum_dtype, (mean_var.dtype, output_dtype) assert mean_var.dtype == sum_dtype, (mean_var.dtype, sum_dtype)
# Check that we can take the gradient, when implemented # Check that we can take the gradient, when implemented
try: try:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论