B=np.pad(A,((上1, 下2),(左3, 右4)),'constant',constant_values = (0,0))
A = np.arange(1,5).reshape(2,2)
print(A)
[[1 2]
[3 4]]
B=np.pad(A,((1,2),(3,4)),'constant',constant_values = (0,0))
print(B)
[[0 0 0 0 0 0 0 0 0]
[0 0 0 1 2 0 0 0 0]
[0 0 0 3 4 0 0 0 0]
[0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0]]