Array API compatible wrapper for :py:func:`np.empty `. See its docstring for more information.
(
shape: Union[int, Tuple[int, ...]],
*,
dtype: Optional[Dtype] = None,
device: Optional[Device] = None,
)
| 95 | |
| 96 | |
| 97 | def empty( |
| 98 | shape: Union[int, Tuple[int, ...]], |
| 99 | *, |
| 100 | dtype: Optional[Dtype] = None, |
| 101 | device: Optional[Device] = None, |
| 102 | ) -> Array: |
| 103 | """ |
| 104 | Array API compatible wrapper for :py:func:`np.empty <numpy.empty>`. |
| 105 | |
| 106 | See its docstring for more information. |
| 107 | """ |
| 108 | from ._array_object import Array |
| 109 | |
| 110 | _check_valid_dtype(dtype) |
| 111 | if device not in ["cpu", None]: |
| 112 | raise ValueError(f"Unsupported device {device!r}") |
| 113 | return Array._new(np.empty(shape, dtype=dtype)) |
| 114 | |
| 115 | |
| 116 | def empty_like( |