empty_like( prototype, /, dtype=None, order='K', subok=True, shape=None, *, device=None, ) -- Return a new array with the same shape and type as a given array. Parameters ---------- prototype : array_like
(
prototype, dtype=None, order="K", subok=True, shape=None, *, device=None
)
| 114 | |
| 115 | @array_function_from_c_func_and_dispatcher(_multiarray_umath.empty_like) |
| 116 | def empty_like( |
| 117 | prototype, dtype=None, order="K", subok=True, shape=None, *, device=None |
| 118 | ): |
| 119 | """ |
| 120 | empty_like( |
| 121 | prototype, |
| 122 | /, |
| 123 | dtype=None, |
| 124 | order='K', |
| 125 | subok=True, |
| 126 | shape=None, |
| 127 | *, |
| 128 | device=None, |
| 129 | ) |
| 130 | -- |
| 131 | |
| 132 | Return a new array with the same shape and type as a given array. |
| 133 | |
| 134 | Parameters |
| 135 | ---------- |
| 136 | prototype : array_like |
| 137 | The shape and data-type of `prototype` define these same attributes |
| 138 | of the returned array. |
| 139 | dtype : data-type, optional |
| 140 | Overrides the data type of the result. |
| 141 | order : {'C', 'F', 'A', or 'K'}, optional |
| 142 | Overrides the memory layout of the result. 'C' means C-order, |
| 143 | 'F' means F-order, 'A' means 'F' if `prototype` is Fortran |
| 144 | contiguous, 'C' otherwise. 'K' means match the layout of `prototype` |
| 145 | as closely as possible. |
| 146 | subok : bool, optional. |
| 147 | If True, then the newly created array will use the sub-class |
| 148 | type of `prototype`, otherwise it will be a base-class array. Defaults |
| 149 | to True. |
| 150 | shape : int or sequence of ints, optional. |
| 151 | Overrides the shape of the result. If order='K' and the number of |
| 152 | dimensions is unchanged, will try to keep order, otherwise, |
| 153 | order='C' is implied. |
| 154 | device : str, optional |
| 155 | The device on which to place the created array. Default: None. |
| 156 | For Array-API interoperability only, so must be ``"cpu"`` if passed. |
| 157 | |
| 158 | .. versionadded:: 2.0.0 |
| 159 | |
| 160 | Returns |
| 161 | ------- |
| 162 | out : ndarray |
| 163 | Array of uninitialized (arbitrary) data with the same |
| 164 | shape and type as `prototype`. |
| 165 | |
| 166 | See Also |
| 167 | -------- |
| 168 | ones_like : Return an array of ones with shape and type of input. |
| 169 | zeros_like : Return an array of zeros with shape and type of input. |
| 170 | full_like : Return a new array with shape of input filled with value. |
| 171 | empty : Return a new uninitialized array. |
| 172 | |
| 173 | Notes |
no outgoing calls
searching dependent graphs…