Replies: 1 comment 4 replies
-
Thanks for the nice words. I think I could maybe try to answer if there were some clarifications. As it is, I don't see what it means to apply |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
ndarray
is truely great, but one thing I really love aboutnumpy
is how easy it is to write code that generalises over unspecified dimensions. I found this to be much harder withndarray
. For example, imagine I want to apply the following function along the innermost axis:Let's say I have two arrays,
arrayA
with shape(100, 20, 3)
andarrayB
with shape(100, 20, 4)
. How can an apply functions to the inntermost axis, leaving all other dimensions in place?I can easily apply
do_something_1()
withmap_axis
along the last axis ofarrayA
, resulting in an array of shape(100, 20)
. But how can I do the same fordo_something_2
, iterating over both arrays? I checked the documentation and thoughtZip
andlanes()
might work, but everything I tried either ended up being way too complicated or didn't work at all.Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions