Are you sure these snippets are correct? Just comparing to TensorFlow’s example 23:
indices = torch.ByteTensor([[0, 0], [1, 1]])
params  = torch.Tensor([[1, 2], [3, 4]])
params.masked_select(indices)

Tensorflow documentation says the output should be tensor([ 1., 4.]), but your code gives tensor([ 3., 4.])