Tansor swapping

How to make the following in simple way?

a = torch.zeros(4,3)
t = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]], dtype=torch.float)
index1 = torch.tensor([1, 3])
index2 = torch.tensor([0, 2])
a.index_copy_(0, index1, t[index2])

Output:
tensor([[0., 0., 0.],
[1., 2., 3.],
[0., 0., 0.],
[7., 8., 9.]])

Your code looks already quite simple. I’m unsure which part you would like to remove.