a = torch.Tensor([0.1, 0.2, 0.6, 0.3])
b = (a >= 0.5)

I think this would work, if you need a variable instead of a tensor, you may use:
a = Variable(torch.Tensor([0.1, 0.2, 0.6, 0.3]))
b = (a >= 0.5)