Array API compatible wrapper for :py:func:`np.zeros `. See its docstring for more information.
(
shape: Union[int, Tuple[int, ...]],
*,
dtype: Optional[Dtype] = None,
device: Optional[Device] = None,
)
| 317 | |
| 318 | |
| 319 | def zeros( |
| 320 | shape: Union[int, Tuple[int, ...]], |
| 321 | *, |
| 322 | dtype: Optional[Dtype] = None, |
| 323 | device: Optional[Device] = None, |
| 324 | ) -> Array: |
| 325 | """ |
| 326 | Array API compatible wrapper for :py:func:`np.zeros <numpy.zeros>`. |
| 327 | |
| 328 | See its docstring for more information. |
| 329 | """ |
| 330 | from ._array_object import Array |
| 331 | |
| 332 | _check_valid_dtype(dtype) |
| 333 | if device not in ["cpu", None]: |
| 334 | raise ValueError(f"Unsupported device {device!r}") |
| 335 | return Array._new(np.zeros(shape, dtype=dtype)) |
| 336 | |
| 337 | |
| 338 | def zeros_like( |