Many thanks. So, for every one who have the same problem, we could rewrite the code so simple as bellow:
import torch
input = torch.zeros((2, 1, 4, 2))
print(input)

temp = torch.ones((input.shape[0], input.shape[1], input.shape[2], 1))
#temp = torch.ones((2, 1, 4, 1))

input = torch.cat((temp, input), 3)
print(input)

input = torch.cat((input, temp), 3)
print(input)

temp = torch.ones((input.shape[0], input.shape[1], 1, input.shape[3]))

input = torch.cat((input, temp), 2)
print(input)

input = torch.cat((temp, input), 2)
print(input)

Thanks again