Masking in Einops #301
Closed
JTrainer-STORi
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Hi @JTrainer-STORi , thx for suggestion. I don't think it is a good addition to reduce:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For the reduce function, specify a
mask
argument. Thereduce
function would then be applied to the entries in the array for which the mask argument = True. For an example of how this would work, take an example arrayarray = [[1, 3, 4],[5, 4, 1],[8, 0, 6]]
andmask = [True, False, True]
. Callingreduce(array, 'a b -> b', 'sum', mask)
would then return[9, 3, 10]
ignoring the middle row of the array for which the mask = False in the summation.This feature would be personally useful for me because I enjoy the syntax of einops and I'm currently in a situation where I need to implement masking in a neural network. Being able to use the above syntax would make the code as a whole much cleaner.
Beta Was this translation helpful? Give feedback.
All reactions