提交 8c8ee26e authored 作者: Jeremiah Lowin's avatar Jeremiah Lowin

Add case where 'axis' is a numpy scalar array

If the 'axis' variable is a numpy scalar array (like numpy.array(1)), these conditional branches will fail as it tries to build a set over the non-iterable array. I've added another branch to handle this case.
上级 2345e188
......@@ -1250,6 +1250,8 @@ class CAReduce(Op):
# See <http://projects.scipy.org/numpy/ticket/2235>.
elif isinstance(axis, (int, numpy.integer)):
self.axis = (axis,)
elif isinstance(axis, numpy.ndarray) and axis.ndim == 0:
self.axis = (int(axis),)
else:
self.axis = list(set(axis))
self.axis.sort()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论