我需要一些帮助:
void RBM::sample_v_given_h(int *h0_sample, double *mean, int *sample) {
int c = 0;
double r;
for(int i=0; i<n_visible; i++) {
mean[i] = propdown(h0_sample, i, vbias[i]);
if(mean[i] < 0 || mean[i] > 1)
sample[i] = 0;
else{
r = rand() / (RAND_MAX + 1.0);
if (r < mean[i]) c++;
sample[i] = c;
}
}
}
当我使用rand()生成随机数时,如上例所示,PGI编译器给出了一个错误:
Procedures called in a compute region must have acc routine information: rand (./RBM.cpp: 166)
或如下
Accelerator restriction: call to 'rand' with no acc routine
当我调用具有rand()
的函数时