Bi boolean statements

Lets say i have a tensor X
now i want to change all elements in the range (r1,r2) to y

i’m trying to do
X[r1<X and X < r2] = y

But i getting
RuntimeError: Boolean value of Tensor with more than one value is ambiguous

Is there a way to do this operation?

Thanks

Solved

X[torch.logical_and(condition, condition)] = y