Created
September 23, 2019 20:48
-
-
Save Hanrui-Wang/30ea2a1bf38ed06c0f263c68c67a0115 to your computer and use it in GitHub Desktop.
get_nonzero_index in pytorch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mask_i = (target >= start) & (target < end) | |
indices_i = mask_i.nonzero().squeeze() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment