提交 1ef98f47 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Fix bug with python2.4

int(numpy.bool_(False)) returned False, not 0.
上级 d4feee66
...@@ -868,11 +868,15 @@ nd_collapse_[i]=0; ...@@ -868,11 +868,15 @@ nd_collapse_[i]=0;
#check that all inputs have valid dimensions #check that all inputs have valid dimensions
emitted_inames = {} emitted_inames = {}
for id,iname in enumerate(inputs): for id, iname in enumerate(inputs):
if iname in emitted_inames: if iname in emitted_inames:
assert emitted_inames[iname] is node.inputs[id] assert emitted_inames[iname] is node.inputs[id]
continue continue
broadcasts = ', '.join(map(str,map(int,node.inputs[id].broadcastable)))
# with python 2.4 (at least), if a broadcastable pattern is made of
# numpy.bool_ instead of bool, calling int() once is not enough.
broadcasts = map(int, map(int, node.inputs[id].broadcastable))
broadcasts = ', '.join(map(str, broadcasts))
nd = node.inputs[id].ndim nd = node.inputs[id].ndim
if nd > 0: if nd > 0:
print >> sio, """ print >> sio, """
...@@ -883,9 +887,10 @@ nd_collapse_[i]=0; ...@@ -883,9 +887,10 @@ nd_collapse_[i]=0;
int *broadcasts_%(iname)s = NULL; int *broadcasts_%(iname)s = NULL;
""" % locals() """ % locals()
emitted_inames[iname] = node.inputs[id] emitted_inames[iname] = node.inputs[id]
#check that all inputs have valid dimensions #check that all inputs have valid dimensions
emitted_inames = {} emitted_inames = {}
for id,iname in enumerate(inputs): for id, iname in enumerate(inputs):
if iname in emitted_inames: if iname in emitted_inames:
continue continue
print >> sio, """ print >> sio, """
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论