zeros_like

zeros_like(x: array, /, *, dtype: dtype | None = None, device: device | None = None) array

Returns a new array filled with zeros and having the same shape as an input array x.

Parameters:
  • x (array) – input array from which to derive the output array shape.

  • dtype (Optional[dtype]) – output array data type. If dtype is None, the output array data type must be inferred from x. Default: None.

  • device (Optional[device]) – device on which to place the created array. If device is None, the output array device must be inferred from x. Default: None.

Returns:

out (array) – an array having the same shape as x and filled with zeros.