MCPcopy Create free account
hub / github.com/numpy/numpy / empty

Function empty

numpy/array_api/_creation_functions.py:97–113  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

95
96
97def 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
116def empty_like(

Callers 15

onesFunction · 0.50
fullFunction · 0.50
crossFunction · 0.50
indicesFunction · 0.50
vanderFunction · 0.50
deleteFunction · 0.50
insertFunction · 0.50
pinvFunction · 0.50

Calls 2

_check_valid_dtypeFunction · 0.85
_newMethod · 0.80