Oh btw I remembered that there is a function which return those indices:
import torch

with torch.no_grad():
    tensor = torch.rand(4, 4)
    # generate zero elements
    tensor[tensor < 0.5] = 0
    print(tensor)
    # Obtain position of non-zero elements
    print(tensor.nonzero())

tensor([[0.0000, 0.7300, 0.7180, 0.0000],
        [0.0000, 0.7008, 0.5255, 0.0000],
        [0.6798, 0.0000, 0.0000, 0.6164],
        [0.9133, 0.0000, 0.7820, 0.0000]])
tensor([[0, 1],
        [0, 2],
        [1, 1],
        [1, 2],
        [2, 0],
        [2, 3],
        [3, 0],
        [3, 2]])

Soo given this you can easily apply the interpolation