numpy.__array_namespace_info__.default_dtypes#
method
- __array_namespace_info__.default_dtypes(*, device=None)[源代码]#
用于新NumPy数组的默认数据类型.
对于NumPy,这始终返回以下字典:
“real floating”:
numpy.float64“complex floating”:
numpy.complex128“integral”:
numpy.intp“indexing”:
numpy.intp
- 参数:
- devicestr, optional
要获取默认数据类型的设备.对于NumPy,仅允许使用
'cpu'.
- 返回:
- dtypesdict
描述用于新建 NumPy 数组的默认数据类型的字典.
参见
示例
>>> info = np.__array_namespace_info__() >>> info.default_dtypes() {'real floating': numpy.float64, 'complex floating': numpy.complex128, 'integral': numpy.int64, 'indexing': numpy.int64}