提交 5fa767de authored 作者: Matthew Koichi Grimes's avatar Matthew Koichi Grimes

fixed too-stringent typecheck to accept not just bool, but also numpy.bool_

上级 5e1295f2
...@@ -657,11 +657,13 @@ class Rebroadcast(gof.Op): ...@@ -657,11 +657,13 @@ class Rebroadcast(gof.Op):
items = sorted(axis) items = sorted(axis)
self.axis = OrderedDict(items) self.axis = OrderedDict(items)
for axis, broad in iteritems(self.axis): for axis, broad in iteritems(self.axis):
assert isinstance(axis, (numpy.integer, int)), ( if not isinstance(axis, (numpy.integer, int)):
"Rebroadcast needs integer axes. Got ", axis) raise TypeError("Rebroadcast needs integer axes. "
assert isinstance(broad, bool), ( "Got {}".format(axis))
"Rebroadcast needs bool for new broadcast pattern. Got ",
broad) if not isinstance(broad, (numpy.bool_, bool)):
raise TypeError("Rebroadcast needs bool for new broadcast "
"pattern. Got {}".format(broad))
def __hash__(self): def __hash__(self):
# Need special __hash__ as dict aren't hashable. # Need special __hash__ as dict aren't hashable.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论