Not the best solution, but at least just one line:
T.clone().index_put_([torch.arange(0, s, out=torch.LongTensor())], torch.tensor([0], dtype=torch.float))
Seems any fixes is not made for the output type of torch.arange ? (https://github.com/pytorch/pytorch/issues/2812 11)