提交 bc58ef40 authored 作者: happygds's avatar happygds 提交者: GitHub

Update basic.py

上级 6cf17098
...@@ -4220,10 +4220,7 @@ def roll(x, shift, axis=None): ...@@ -4220,10 +4220,7 @@ def roll(x, shift, axis=None):
axis = 0 axis = 0
if axis < 0: if axis < 0:
if x.ndim == 0: axis += x.ndim
axis = 0
else:
axis = axis % x.ndim
# Shift may be larger than the size of the axis. If so, since the # Shift may be larger than the size of the axis. If so, since the
# roll operation is cyclic, we can take the shift modulo the size # roll operation is cyclic, we can take the shift modulo the size
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论