Hello fbrah!



 fbrah:

Lets say seq_len = 128
consider X = myTensor[0,:].  # this would be of size [1, 128].
for example: X = [4,121,4,501,100, …,125, 90,92, 100, …,125]
I want all values between (including) 100 and 125 which I showed with …, set to -1. And I want to do that for all rows of myTensor (#row = batch_size)
I hope I could clarify this. Thanks again
Is there anyway I can use masked_fill_() for this but not with respect to actual values?


Based on what I think you want, the masked_fill_() code I posted
should work for you.
Could you post a short, self-contained script that uses masked_fill_()
as I described, together with its output (including errors, if any), and
compare, concretely, what masked_fill_() gives you with what you
actually want?
Good luck.
K. Frank