I’m not sure if it would perfectly fit your use case, as I didn’t fully understand the desired behavior regarding the stride and kernel size, but the replication padding would match your output:
A = torch.tensor([[
                  [0, 1],
                  [1, 0]
]]).float()

B = F.pad(A.unsqueeze(1), (1, 1, 1, 1), mode='replicate')
print(B)
> tensor([[[[0., 0., 1., 1.],
            [0., 0., 1., 1.],
            [1., 1., 0., 0.],
            [1., 1., 0., 0.]]]])

You could squeeze(1) the additionally added dimension afterwards, if needed.