通常是不一样的,除了某些特例:比如当img是一个numpy.ndarray, x, y, z都是整数的时候,确实是一样。
除此之外,随便举个例子:
# img[x, y, z] where x = [1, 2], y=2, z=[3, 4]
In [41]: img = np.arange(3 * 4 * 5).reshape((3, 4, 5))
In [42]: img[[1, 2], 2, [3, 4]]
Out[42]: array([33, 54])
In [43]: img[[1, 2], 2][[3, 4]]
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-43-7635c00032f8> in <module>
----> 1 img[[1, 2], 2][[3, 4]]
IndexError: index 3 is out of bounds for axis 0 with size 2
【 在 life2018 的大作中提到: 】
: 咨询各位,如题的两个数组有实际区别吗?还是说就是多种理解而已
: 多谢。
--
FROM 180.164.90.*