提交 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):
items = sorted(axis)
self.axis = OrderedDict(items)
for axis, broad in iteritems(self.axis):
assert isinstance(axis, (numpy.integer, int)), (
"Rebroadcast needs integer axes. Got ", axis)
assert isinstance(broad, bool), (
"Rebroadcast needs bool for new broadcast pattern. Got ",
broad)
if not isinstance(axis, (numpy.integer, int)):
raise TypeError("Rebroadcast needs integer axes. "
"Got {}".format(axis))
if not isinstance(broad, (numpy.bool_, bool)):
raise TypeError("Rebroadcast needs bool for new broadcast "
"pattern. Got {}".format(broad))
def __hash__(self):
# Need special __hash__ as dict aren't hashable.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论