np.zeros_like(a)
的目的是构建一个与a同维度的数组,并初始化所有变量为零。
def zeros_like(a, dtype=None, order='K', subok=True, shape=None):
Return an array of zeros with the same shape and type as a given array.
Parameters
----------
a : array_like
The shape and data-type of `a` define these same attributes of
the returned array.
out : ndarray
Array of zeros with the same shape and type as `a`.