Array API compatible wrapper for :py:func:`np.zeros_like `. See its docstring for more information.
(
x: Array, /, *, dtype: Optional[Dtype] = None, device: Optional[Device] = None
)
| 336 | |
| 337 | |
| 338 | def zeros_like( |
| 339 | x: Array, /, *, dtype: Optional[Dtype] = None, device: Optional[Device] = None |
| 340 | ) -> Array: |
| 341 | """ |
| 342 | Array API compatible wrapper for :py:func:`np.zeros_like <numpy.zeros_like>`. |
| 343 | |
| 344 | See its docstring for more information. |
| 345 | """ |
| 346 | from ._array_object import Array |
| 347 | |
| 348 | _check_valid_dtype(dtype) |
| 349 | if device not in ["cpu", None]: |
| 350 | raise ValueError(f"Unsupported device {device!r}") |
| 351 | return Array._new(np.zeros_like(x._array, dtype=dtype)) |