Pytorch mask tensor with boolean numpy array
I have a 84x84 pytorch tensor named target. I need to mask it with an 84x84 boolean numpy array which consists of True and False. 

When I do target = target[mask], I get the error TypeError: can't convert np.ndarray of type numpy.bool_. The only supported types are: double, float, float16, int64, int32, and uint8.

Surprisingly, I get this error only when running on a GPU. When running on a CPU, everything works fine. How can I fix this?

I think there is some confusion with the types. But this works.

import torch
tensor = torch.randn(84,84)
c = torch.randn(tensor.size()).bool()
c[1, 2:5] = False
x = tensor[c].size()


For testing I created a tensor with random values. Afterwards 3 elements are set to False. In the last step I look get the size 7053 resulting from 84^2 - 3.

Hope that helps somehow.
