gpt4 book ai didi

python - 属性 numpy.dtype.base 的目的/状态

转载 作者:太空宇宙 更新时间:2023-11-04 04:32:08 25 4
gpt4 key购买 nike

我在 numpy.dtype 对象上找到了一个名为 base 的属性。做一些实验:

numpy.dtype('i4').base
# dtype('int32')
numpy.dtype('6i4').base
# dtype('int32')
numpy.dtype('10f8').base
# dtype('float64')
numpy.dtype('3i4, 2f4')
# dtype([('f0', '<i4', (3,)), ('f1', '<f4', (2,))])

所以它似乎包含单个元素的 dtype 用于简单的子数组数据类型,它本身用于结构化数据类型。

不幸的是,这个属性似乎没有在任何地方记录。 一个page in the documentation ,但它是空的,没有链接到任何地方。奇怪的是,numpy 版本 1.15.0 的文档中也没有具体说明:

我能否在 numpy 的 future 版本中依赖此属性的存在和行为?

最佳答案

现在记录在案:

https://numpy.org/doc/stable/reference/generated/numpy.dtype.base.html#numpy.dtype.base

定义在https://github.com/numpy/numpy/blob/eeef9d4646103c3b1afd3085f1393f2b3f9575b2/numpy/core/src/multiarray/descriptor.c#L2255-L2300从 git-blame 上次被触及到大约 13 年前,所以可以安全地假设 dtype.base 将存在并继续存在。

关于python - 属性 numpy.dtype.base 的目的/状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52476601/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com