Solved by ClementPinard in post #2 
              
              
                You will have problems regarding one of the inner dimensions, as you won’t have always the same number of elements 
here’s a little over-simplified example : 
t = torch.Tensor(2, 2).random_(0, 2).long()
# t = [ 0, 0,
#       1, 0] (long tensor)
m = t == 1
# m = [[0, 0],
#      [1, 0]]  (byte tensor …