简体   繁体   English

AttributeError:'CommandQueue'对象没有属性'dtype'

[英]AttributeError: 'CommandQueue' object has no attribute 'dtype'

I am trying to calculate a FFT with pyFFT. 我正在尝试使用pyFFT计算FFT。 But the following code results in the error. 但是以下代码会导致错误。

self.ctx = cl.create_some_context(interactive=False)            
self.queue = cl.CommandQueue(self.ctx)   
self.plan = Plan(fft_size, self.queue)   
gpu_data0 = cl_array.to_device(self.ctx, self.queue, ref_input)   

ref_input is of type: ref_input的类型为:

< type 'numpy.ndarray' >

debug output: 调试输出:

< pyopencl._cl.CommandQueue object at 0x7f0686c10628 >    
['__class__', '__delattr__', '__dict__', '__doc__', '__enter__', '__eq__', 
 '__exit__','__format__', '__getattribute__', '__hash__', '__init__', 
 '__instance_size__', '__module__', '__ne__', '__new__', '__reduce__', 
 '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', 
 '__subclasshook__', '__weakref__', '_get_cl_version', 'context', 'device', 
 'finish', 'flush', 'from_int_ptr', 'get_info', 'int_ptr', 'properties',    
 'reference_count']   

Traceback (most recent call last):
   File "../dsp.py", line 200, in gpu_fft
     gpu_data0 = cl_array.to_device(self.ctx, self.queue, ref_data)
   File "/usr/lib/python2.7/dist-packages/pyopencl/array.py", line 1446, in to_device
     if ary.dtype == object:
 AttributeError: 'CommandQueue' object has no attribute 'dtype'

In fact I cannot find 'dtype'. 实际上我找不到'dtype'。 But why? 但为什么?

The function pyopencl.array.to_device does not take the context as a parameter according to the documentation. 根据文档,函数pyopencl.array.to_device不将上下文作为参数。 Use this instead: 使用此代替:

gpu_data0 = cl_array.to_device(self.queue, ref_input)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AttributeError:类型对象&#39;object&#39;没有属性&#39;dtype&#39; - AttributeError: type object 'object' has no attribute 'dtype' AttributeError:“列表”对象没有属性“ dtype” - AttributeError: 'list' object has no attribute 'dtype' AttributeError: 'float' object 没有属性 'dtype' - AttributeError: 'float' object has no attribute 'dtype' AttributeError:“ NoneType”对象没有属性“ dtype” - AttributeError: 'NoneType' object has no attribute 'dtype' AttributeError: 'df' object 没有属性 'dtype' - AttributeError: 'df' object has no attribute 'dtype' AttributeError: &#39;int&#39; 对象没有属性 &#39;dtype&#39; - AttributeError: 'int' object has no attribute 'dtype' AttributeError:“ TensorSliceDataset”对象没有属性“ dtype” - AttributeError: 'TensorSliceDataset' object has no attribute 'dtype' “AttributeError: &#39;DataFrame&#39; 对象没有属性 &#39;dtype&#39;” 使用 Pandas to_datetime - "AttributeError: 'DataFrame' object has no attribute 'dtype'" using pandas to_datetime AttributeError: 'DataFrame' object 没有属性 'get_dtype_counts' - AttributeError: 'DataFrame' object has no attribute 'get_dtype_counts' 估算器API:AttributeError:&#39;NoneType&#39;对象没有属性&#39;dtype&#39; - Estimator API: AttributeError: 'NoneType' object has no attribute 'dtype'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM