Skip to content

Candle equivalent to masked_scatter? #2208

Answered by LaurentMazare
vody-am asked this question in Q&A
Discussion options

You must be logged in to vote

If the mask has a "regular" shape (e.g. the image embeddings are before or after the text ones in some dimensions), maybe you can just use a Tensor::cat instead?
Otherwise I would suggest processing this manually on the cpu to start with and get sure that the model works well.
Longer term, maybe add a custom op or maybe simpler: use index_select where the indexes are computed based on the mask itself + multiply by a 0/1 mask to ensure that only the relevant bits are kept.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@vody-am
Comment options

@vody-am
Comment options

@LaurentMazare
Comment options

Answer selected by vody-am
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants