Replace a value in pytorch tensor t=tensor([0.1 0.2 0.3 0.4 0.5 0.6])

now i need to modify this existing tensor t as follows:
t=tensor([0.1 0.2 0.7 0.4 0.8 0.6])

I tried as follows:
t=tensor([0.1 0.2 0.3 0.4 0.5 0.6])
a=tensor([0.1 0.2 0.7 0.4 0.8 0.6])
index=range(len(a))
t.index_copy_(0,index,a)

But still it is not updating
how can i modify the tensor in pytorch?
Try this:
t = tensor([0.1, 0.2, 0.3, 0.4, 0.5, 0.6])
t.index_copy_(0, tensor([2, 4]), tensor([0.7, 0.8]))

Reference:
torch.Tensor.index_copy_