Copying data from one pytorch tensor to another using bit masking

import torch
a = torch.zeros(5)
b = torch.tensor(tuple((0,1,0,1,0)),dtype=torch.uint8)
c= torch.tensor([7.,9.])

tensor([0., 7., 0., 9., 0.])

I am struggling to understand how this works. I initially thought the above code was using Fancy indexing but I realised that values from c tensors are getting copied corresponding to the indices marked 1. Also, if I don’t specify dtype of b as uint8 then the above code does not work. Can someone please explain me the mechanism of the above code.

The link below explains this behaviour