Found some strange behavior of masked_scatter_. which confuses the C type indices and Pascal type indices.
Following is a minimum example:
a = autograd.Variable(torch.zeros(3,2))
Variable containing:
 0  0
 0  0
 0  0
[torch.FloatTensor of size 3x2]

m = autograd.Variable(torch.ByteTensor([1,0]))
Variable containing:
 1
 0
[torch.ByteTensor of size 2]

c = autograd.Variable(torch.arange(0, 6).view(3,2))
Variable containing:
 0  1
 2  3
 4  5
[torch.FloatTensor of size 3x2]

a.masked_scatter_(m.expand(3,-1), c)

I am planning to obtain
Variable containing:
 0  0
 2  0
 4  0
[torch.FloatTensor of size 3x2]

But got
Variable containing:
 0  0
 1  0
 2  0
[torch.FloatTensor of size 3x2]


Any idea that can help solve this?
Thanks a lot!