由于这个未来警告,如何正确调整代码? (多维索引 numpy)

How to properly adjust code due to this futurewarning? (multidimensional indexing numpy)

如何调整此代码中的索引,使其在出现此 FutureWarning 时正常工作?

D:/Arc/Arc_Project\Architecture\_Z07_Adjust_X_Y\backward_sequentialize.py:165: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
a = np.asarray([
           np.asarray([
              np.asarray([1,1,1,1]),
              np.asarray([1,1,0,1]),
              np.asarray([1,1,1,1])
                                  ]),
          np.asarray([
              np.asarray([1,1,1,1]),
              np.asarray([1,1,1,1]),
              np.asarray([1,1,1,1])
                                  ]),
         np.asarray([
              np.asarray([1,1,1,1]),
              np.asarray([1,1,2,1]),
              np.asarray([1,1,1,1])
                                  ])
         np.asarray([
              np.asarray([1,1,1,1]),
              np.asarray([1,1,3,1]),
              np.asarray([1,1,1,1])
                                  ])
         np.asarray([
              np.asarray([1,1,1,1]),
              np.asarray([1,1,4,1]),
              np.asarray([1,1,1,1])
                                  ])
         np.asarray([
              np.asarray([1,1,1,1]),
              np.asarray([1,1,5,1]),
              np.asarray([1,1,1,1])
                                  ]) ])
locs = [2,5]
print(a[[locs]])
         [ [1,1,1,1]
           [1,1,2,1]
           [1,1,1,1] ]
         [ [1,1,1,1]
           [1,1,5,1]
           [1,1,1,1] ]

我说得对吗 locs = tuple([2,5]) 会做吗?

编辑:我不只是希望警告消失,因为正如它所说,它将来可能无法正常工作。

编辑:我也在这样做:(如何调整它?)

    a = np.array([x[-(SEQ_LEN):] for x in a])

为了访问给定的元素,只需发送所需索引的数组,然后是 , 来表示其他轴,return 是给定轴中所需的索引。

array[([2,5],)],那应该会处理的。