How to fill a tensor indexed by another tensor

suppose there are 2 tensors.
t1:
[[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]]
t2:
[0, 1, 2]
the t1.size(0) equals t2.size(0)
I want some function to do like:
func(t1, t2, padding) ->
[[padding, 2, 3, 4],
[5, padding, 7, 8],
[9, 10, padding, 12]].

what I get is doing some stupid for loop like

for i in range(t1.size(0)):
    t1[t2[i]] = padding

Are there some better solutions? It can do it in-place or produce a new tensor.

Thanks