1
您好我在pyopencl中編寫此代碼以獲得稀疏隨機向量,但問題是我無法將任何值寫入索引數組有什麼問題?輸出始終爲零!在pyopencl中寫入索引數組
這裏是我的代碼
import pyopencl as cl
import numpy as np
from pyopencl import array
from pyopencl import clrandom
ctx = cl.create_some_context()
queue = cl.CommandQueue(ctx,
properties=cl.command_queue_properties.PROFILING_ENABLE)
x=array.zeros(queue, 512, dtype=np.float32)
indices = clrandom.rand(queue, 17 , dtype=np.int32 ,luxury=2, a=1 , b=512)
clrandom.RanluxGenerator(queue,luxury=0).fill_normal(x[indices], mu=0, sigma=1)
print x