Example: python how to pad a numpy array with zeros
np.pad(numpy_array, (pad_left, pad_right), 'constant')
np.pad(numpy_array, ((pad_top, pad_bottom), (pad_left, pad_right)), 'constant')
import numpy as np
numpy_array = np.array([1,2,3,4,5])
np.pad(numpy_array, (2, 3), 'constant')
--> array([0, 0, 1, 2, 3, 4, 5, 0, 0, 0])
numpy_array = np.array([[1,2],[3,4]])
array([[1, 2],
[3, 4]])
np.pad(numpy_array, ((1,2),(2,1)), 'constant')
array([[0, 0, 0, 0, 0],
[0, 0, 1, 2, 0],
[0, 0, 3, 4, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0]])