提交 1daa2d29 authored 作者: nouiz's avatar nouiz

Merge pull request #1192 from lamblin/fix_py24

Small fixes for Python 2.4
......@@ -1185,6 +1185,9 @@ def local_subtensor_make_vector(node):
# if it is a constant we can do something with it
try:
v = get_scalar_constant_value(idx)
if isinstance(v, numpy.integer):
# Python 2.4 wants to index only with Python integers
v = int(v)
return [x.owner.inputs[v]]
except NotScalarConstantError:
pass
......
......@@ -5,6 +5,7 @@ import sys
import theano.tensor as T
from theano import tensor
from theano.gof.python25 import product as itertools_product
from theano.gof.python25 import any
from theano.printing import pp
import numpy
......@@ -857,7 +858,6 @@ def test_dot22():
assert _dot22 in [x.op for x in topo], (dtype1, dtype2)
else:
check = [isinstance(x.op, T.Dot) for x in topo]
from theano.gof.python25 import any
assert any(check), (dtype1, dtype2)
rng = numpy.random.RandomState(unittest_tools.fetch_seed())
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论