提交 85dfd1be authored 作者: Frederic's avatar Frederic

Fix a test crash in python 2.4 that I inserted recently.

上级 c8bdbc81
...@@ -621,7 +621,11 @@ def get_scalar_constant_value(v): ...@@ -621,7 +621,11 @@ def get_scalar_constant_value(v):
#idx_list can contain Scalar Type object. #idx_list can contain Scalar Type object.
isinstance(v.owner.op.idx_list[0], (int, long, isinstance(v.owner.op.idx_list[0], (int, long,
numpy.integer))): numpy.integer))):
ret = v.owner.inputs[0].owner.inputs[v.owner.op.idx_list[0]]
# Python 2.4 don't support indexing with numpy.integer
# So we cast it.
idx = int(v.owner.op.idx_list[0])
ret = v.owner.inputs[0].owner.inputs[idx]
ret = get_scalar_constant_value(ret) ret = get_scalar_constant_value(ret)
# MakeVector can cast implicitly its input in some case. # MakeVector can cast implicitly its input in some case.
return theano._asarray(ret, dtype=v.type.dtype) return theano._asarray(ret, dtype=v.type.dtype)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论