I am trying to use two boolean tensors to select the relevant indices of another tensor which I wish to modify.

The following will run, but it won’t actually change x.

I would like to change the elements selected from x by m1 on m2 and then change those elements in x, but I’m not sure how this should be done?

```
import torch
x = torch.zeros(10)
m1 = torch.zeros(10,dtype=torch.bool)
m1[4] = 1
m1[8] = 1
m2 = torch.zeros(m1.sum(),dtype=torch.bool)
m2[-1] = 1
x[m1][m2] -= 1 # I would like for x to now have one element that is nonzero, but it doesn't.
```