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`.