I came across a weird problem:
from numpy import zeros, arange
aa = zeros([1, 3, 10])
aa[0, :, arange(5)].shape
Running this gives me (5,3)
, but I'm expecting (3,5)
.
However, running the following gives me (3,5)
as expected.
aa = zeros([3, 10])
aa[:, arange(5)]
This is easy to fix as part of my program, but it completely ruined my belief.
I tried to search for similar questions that have already been answered but have no idea what to search for.
Thank you and Happy Chinese New Year!
question from:
https://stackoverflow.com/questions/66057244/python-numpy-indexing-returned-shapes 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…