Shrabani_Ghosh:

a = torch.tensor([[0.1, 1.2], [2.2, 3.1], [4.9, 5.2]])


Does simply allocating a new tensor work?
>>> a = torch.tensor([[0.1, 1.2], [2.2, 3.1], [4.9, 5.2]])
>>> b = torch.zeros([3, 3])
>>> b[:3, :2] = a
>>> b
tensor([[0.1000, 1.2000, 0.0000],
        [2.2000, 3.1000, 0.0000],
        [4.9000, 5.2000, 0.0000]])

My suspicion is that even if a native “resize” function were available the implementation would essentially do the same thing here.