参考:Numpy学习——数组填充np.pad()函数的应用 举例说明: import numpy as np a = np.zeros((3, 4), dtype=int) a array([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) # pad(array, pad_width, mode, **kwargs) # array: array_like # pad_width: ((1, 2), (3, 4)) # 1: width of top # 2