How to change a slice of a slice of a tensor?

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.

This works:

import torch
x=torch.zeros(10)
y=torch.arange(x.size(0))
m1=torch.zeros_like(x, dtype=torch.bool)

m1[[4,8]]=1
y=y[m1]
x[y[-1]]=-1
print(x)

tensor([ 0., 0., 0., 0., 0., 0., 0., 0., -1., 0.])