随机模块没有按预期运行

时间:2015-08-18 17:44:49

标签: aleagpu

当我连续运行随机模块时,它给出了相同的结果。我能解决这个问题吗?关于Alea的文档在某些地方确实很少。

let cudaRandom = XorShift7.CUDA.DefaultUniformRandomModuleF32.Default.Create(1,1,uint32 DateTime.Now.Millisecond) :> IRandom<float32>
let createRandomUniformMatrix weights_num_rows weights_num_cols (scaling_factor : float32) location =
    let weights_total_size = weights_num_rows*weights_num_cols

    let cudaBuffer = cudaRandom.AllocCUDAStreamBuffer weights_total_size
    cudaRandom.Fill(0,weights_total_size,cudaBuffer,scaling_factor,location*scaling_factor/2.0f)

    {num_rows = weights_num_rows; num_cols = weights_num_cols; dArray = cudaBuffer}

let weights = createRandomUniformMatrix 1 4 1.0f 0.0f
let bias = createRandomUniformMatrix 1 4 1.0f 0.0f

let t1 = bias.dArray.Gather()
let t2 = weights.dArray.Gather()

printfn "%A" t1
printfn "%A" t2
//val t1 : float32 [] = [|0.680722952f; 0.597810984f; 0.318799376f; 0.726549625f|]
//val t2 : float32 [] = [|0.680722952f; 0.597810984f; 0.318799376f; 0.726549625f|]

0 个答案:

没有答案