array_api_extra.default_dtype

array_api_extra.default_dtype(xp, kind='real floating', *, device=None)

Return the default dtype for the given namespace and device.

This is a convenience shorthand for xp.__array_namespace_info__().default_dtypes(device=device)[kind].

Parameters:
  • xp (array_namespace) – The standard-compatible namespace for which to get the default dtype.

  • kind ({'real floating', 'complex floating', 'integral', 'indexing'}, optional) – The kind of dtype to return. Default is ‘real floating’.

  • device (Device, optional) – The device for which to get the default dtype. Default: current device.

Returns:

The default dtype for the given namespace, kind, and device.

Return type:

dtype