I think the difference is between repeat_interleave and repeat, when we use,
a = torch.randn(3, 3)
torch.repeat_interleave(a, 2)

then it will flatten our ‘a’ matrix first, and then repeat each element two times.
so if ‘a’ is
tensor([[ 1.0735,  0.9241,  0.5039],
        [ 0.3616, -0.4308,  0.5240],
        [ 1.3007,  0.7306,  0.4381]])

then
torch.repeat_interleave(a, 2)

would give
tensor([ 0.7962,  0.7962,  0.6094,  0.6094, -0.5283, -0.5283, -0.8183, -0.8183,
        -1.5764, -1.5764, -0.5292, -0.5292,  1.1216,  1.1216, -3.6188, -3.6188,
        -1.1325, -1.1325])

after reshaping this, we would see matrix like,
torch.repeat_interleave(a, 2).reshape(2, 3, 3)

tensor([[[ 1.0735,  1.0735,  0.9241],
         [ 0.9241,  0.5039,  0.5039],
         [ 0.3616,  0.3616, -0.4308]],

        [[-0.4308,  0.5240,  0.5240],
         [ 1.3007,  1.3007,  0.7306],
         [ 0.7306,  0.4381,  0.4381]]])

while if we use
a.repeat(2, 2)

then, we get,
tensor([[ 1.0735,  0.9241,  0.5039,  1.0735,  0.9241,  0.5039],
        [ 0.3616, -0.4308,  0.5240,  0.3616, -0.4308,  0.5240],
        [ 1.3007,  0.7306,  0.4381,  1.3007,  0.7306,  0.4381],
        [ 1.0735,  0.9241,  0.5039,  1.0735,  0.9241,  0.5039],
        [ 0.3616, -0.4308,  0.5240,  0.3616, -0.4308,  0.5240],
        [ 1.3007,  0.7306,  0.4381,  1.3007,  0.7306,  0.4381]])

if we want same element to appear in nearby index, then we use repeat_interleave, otherwise we use repeat.