Padding
np.pad maintains the original dimensions
np.pad([1,2,3], (2,3), 'constant', constant_values=0) # [0,0,1,2,3,0,0,0]
np.pad([[1,2],[3,4]], 1, 'constant') # [[0,0,0,0], # [0,1,2,0], # [0,3,4,0], # [0,0,0,0]]
Seonglae Cho
Seonglae Chonp.pad([1,2,3], (2,3), 'constant', constant_values=0) # [0,0,1,2,3,0,0,0]
np.pad([[1,2],[3,4]], 1, 'constant') # [[0,0,0,0], # [0,1,2,0], # [0,3,4,0], # [0,0,0,0]]