提交 9f8efc6c authored 作者: Saizheng Zhang's avatar Saizheng Zhang

fixed problem when axis is negative

上级 420b9730
...@@ -662,6 +662,8 @@ def repeat(x, repeats, axis=None): ...@@ -662,6 +662,8 @@ def repeat(x, repeats, axis=None):
else: else:
if axis >= x.ndim: if axis >= x.ndim:
raise ValueError('Axis should not exceed x.ndim-1.') raise ValueError('Axis should not exceed x.ndim-1.')
if axis < 0:
axis = x.ndim+axis
shape = [x.shape[i] for i in xrange(x.ndim)] shape = [x.shape[i] for i in xrange(x.ndim)]
shape_ = shape[:] shape_ = shape[:]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论