Array API compatible wrapper for :py:func:`np.linspace `. See its docstring for more information.
(
start: Union[int, float],
stop: Union[int, float],
/,
num: int,
*,
dtype: Optional[Dtype] = None,
device: Optional[Device] = None,
endpoint: bool = True,
)
| 211 | |
| 212 | |
| 213 | def linspace( |
| 214 | start: Union[int, float], |
| 215 | stop: Union[int, float], |
| 216 | /, |
| 217 | num: int, |
| 218 | *, |
| 219 | dtype: Optional[Dtype] = None, |
| 220 | device: Optional[Device] = None, |
| 221 | endpoint: bool = True, |
| 222 | ) -> Array: |
| 223 | """ |
| 224 | Array API compatible wrapper for :py:func:`np.linspace <numpy.linspace>`. |
| 225 | |
| 226 | See its docstring for more information. |
| 227 | """ |
| 228 | from ._array_object import Array |
| 229 | |
| 230 | _check_valid_dtype(dtype) |
| 231 | if device not in ["cpu", None]: |
| 232 | raise ValueError(f"Unsupported device {device!r}") |
| 233 | return Array._new(np.linspace(start, stop, num, dtype=dtype, endpoint=endpoint)) |
| 234 | |
| 235 | |
| 236 | def meshgrid(*arrays: Array, indexing: str = "xy") -> List[Array]: |