Does anyone know how to quickly apply a mask to a torch tensor? Say I have a tensor **t_in** with some values in it and a mask **t_mask** with values 0 and 1. In numpy I could do the following:

```
t_result = np.ma.array(t_in, mask=t_mask)
```

That would mask all the values of **t_in** where the value of the equivalent index of **t_mask** is 0. Then I can do operations such as `t_result.sum()`

and it will only give me the sum of the non-masked values. I’m primarily looking to do just that, but cannot get my head around how it can be done efficiently with torch tensors.

Thanks