Difference between `masked_fill_` and `masked_scatter_`

So are there any fundamental differences between masked_fill_ and masked_scatter_? By reading the documents, I feel they will yield the same output.

I think I understand the difference now, fill only uses one value, while scatter uses the the whole tensor. Am I correct?

Yes that is correct.

1 Like