Created by: phlrain
for e in var:
对于这种写法,slice 在越界得时候,必须抛出 py::index_error类型的异常, python端才能正确捕捉,然后正常终止 for 循环 x.shape = [2,2]
y = x[10]
错误的提示如下 IndexError: The starting index 10 of slice is out of bounds in tensor 0-th axis, it shound be in the range of [-2, 2)