KeyError: dtype('int32') for Anaconda Accelerate Library



我正在尝试学习如何使用anaconda的加速库。 根据 https://docs.anaconda.com/accelerate/cublas.html,amin(( 方法"查找数组 x 中第一个最大元素的索引。与 np.argmax(x(" 相同。

这是我的代码:

import accelerate.cuda.blas as blas
import numpy as np
self = blas.Blas()
a = np.array([1, 2, 3, 4])
print(self.amin(a))

这是它返回的内容

Traceback (most recent call last):
File "/opt/anaconda1anaconda2anaconda3api.py", line 147, in _dispatch
KeyError: dtype('int32')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersBooDesktopclarify.py", 
line 11, in <module>
print(self.amin(a))
File "/opt/anaconda1anaconda2anaconda3api.py", line 238, in amin
File "/opt/anaconda1anaconda2anaconda3api.py", line 149, in _dispatch
TypeError: int32

np.array 必须是float32数组而不是默认数组int32

import accelerate.cuda.blas as blas
import numpy as np
self = blas.Blas()
a = np.array([1, 2, 3, 4], dtype='float32')
print(self.amin(a))

最新更新