python数组初始化为0_python – 为什么复制> = 16 GB Numpy数组将其所有元素设置为0?...

在我的Anaconda

Python发行版中,复制正好为16 GB或更大的Numpy数组(不管是dtype)将所有复制的元素都设置为0:

>>> np.arange(2 ** 31 - 1).copy() # works fine

array([ 0, 1, 2, ..., 2147483644, 2147483645,

2147483646])

>>> np.arange(2 ** 31).copy() # wait, what?!

array([0, 0, 0, ..., 0, 0, 0])

>>> np.arange(2 ** 32 - 1, dtype=np.float32).copy()

array([ 0.00000000e+00, 1.00000000e+00, 2.00000000e+00, ...,

4.29496730e+09, 4.29496730e+09, 4.29496730e+09], dtype=float32)

>>> np.arange(2 ** 32, dtype=np.float32).copy()

array([ 0., 0., 0., ..., 0., 0., 0.], dtype=float32)

这是np .__ config __.show()这个发行版:

blas_opt_info:

library_dirs = ['/users/username/.anaconda3/lib']

define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]

include_dirs = ['/users/username/.anaconda3/include']

libraries = ['mkl_rt', 'pthread']

lapack_opt_info:

library_dirs = ['/users/username/.anaconda3/lib']

define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]

include_dirs = ['/users/username/.anaconda3/include']

libraries = ['mkl_rt', 'pthread']

mkl_info:

library_dirs = ['/users/username/.anaconda3/lib']

define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]

include_dirs = ['/users/username/.anaconda3/include']

libraries = ['mkl_rt', 'pthread']

openblas_lapack_info:

NOT AVAILABLE

lapack_mkl_info:

library_dirs = ['/users/username/.anaconda3/lib']

define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]

include_dirs = ['/users/username/.anaconda3/include']

libraries = ['mkl_rt', 'pthread']

blas_mkl_info:

library_dirs = ['/users/username/.anaconda3/lib']

define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]

include_dirs = ['/users/username/.anaconda3/include']

libraries = ['mkl_rt', 'pthread']

为了比较,这里是np .__ config __.show()为我的系统Python发行版,没有这个问题:

blas_opt_info:

define_macros = [('HAVE_CBLAS', None)]

libraries = ['openblas', 'openblas']

language = c

library_dirs = ['/usr/local/lib']

openblas_lapack_info:

define_macros = [('HAVE_CBLAS', None)]

libraries = ['openblas', 'openblas']

language = c

library_dirs = ['/usr/local/lib']

openblas_info:

define_macros = [('HAVE_CBLAS', None)]

libraries = ['openblas', 'openblas']

language = c

library_dirs = ['/usr/local/lib']

lapack_opt_info:

define_macros = [('HAVE_CBLAS', None)]

libraries = ['openblas', 'openblas']

language = c

library_dirs = ['/usr/local/lib']

blas_mkl_info:

NOT AVAILABLE

我想知道MKL加速是否是问题.我已经复制了Python 2和3的错误.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值