提交 ee4cea6a authored 作者: Frederic Bastien's avatar Frederic Bastien

Fix for python 3

上级 9840faaf
...@@ -779,9 +779,7 @@ def split_huge_add_or_mul(node): ...@@ -779,9 +779,7 @@ def split_huge_add_or_mul(node):
return False return False
while len(node.inputs) > max_nb_inputs: while len(node.inputs) > max_nb_inputs:
inner_op = [] inner_op = []
for i in xrange(0, for i in range(0, len(node.inputs), max_nb_inputs):
len(node.inputs),
max_nb_inputs):
inner_op.append(node.op(*node.inputs[i: i + max_nb_inputs])) inner_op.append(node.op(*node.inputs[i: i + max_nb_inputs]))
node = node.op(*inner_op).owner node = node.op(*inner_op).owner
return node return node
......
...@@ -482,16 +482,16 @@ def test_many_arg_elemwise(): ...@@ -482,16 +482,16 @@ def test_many_arg_elemwise():
i.e., it is a test of the optimization theano/sandbox/cuda/opt.py:local_gpu_huge_add_or_mul """ i.e., it is a test of the optimization theano/sandbox/cuda/opt.py:local_gpu_huge_add_or_mul """
rng = np.random.RandomState([1, 2, 3]) rng = np.random.RandomState([1, 2, 3])
for num_args in [25]: for num_args in [55]:
for op_to_test in [theano.tensor.add, theano.tensor.mul]: for op_to_test in [theano.tensor.add, theano.tensor.mul]:
for nb_dim in [2, 3, 4, 5]: for nb_dim in [2, 3, 4, 5]:
shapes = [rng.randint(1, 5) for i in range(nb_dim)] shapes = [rng.randint(1, 5) for i in range(nb_dim)]
args = [np.cast['float32'](rng.randn(*shapes)) args = [np.cast['float32'](rng.randn(*shapes))
for arg in xrange(0, num_args)] for arg in range(0, num_args)]
symb_args = [theano.tensor.TensorType('float32', symb_args = [theano.tensor.TensorType('float32',
(False,) * nb_dim)() (False,) * nb_dim)()
for arg in xrange(0, num_args)] for arg in range(0, num_args)]
outputs = [] outputs = []
for mode in [mode_with_gpu, mode_without_gpu]: for mode in [mode_with_gpu, mode_without_gpu]:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论