Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Deep learning 在caffe的正向gpu中打印变量_Deep Learning_Caffe - Fatal编程技术网

Deep learning 在caffe的正向gpu中打印变量

Deep learning 在caffe的正向gpu中打印变量,deep-learning,caffe,Deep Learning,Caffe,我想在caffe中的前向gpu函数中打印某一层的斑点,但是我在这样做时遇到了分割错误 template<typename Dtype> void layer_name<Dtype>::Forward_gpu(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) { const Dtype* data_pointer =

我想在caffe中的前向gpu函数中打印某一层的斑点,但是我在这样做时遇到了分割错误

template<typename Dtype>
void layer_name<Dtype>::Forward_gpu(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top)
{
    const Dtype* data_pointer = this->blobs_[0]->gpu_data();
    std::cout<<data_pointer[0]<<std::endl;
}
模板
无效层\u名称::正向\u gpu(常量向量和底部、常量向量和顶部)
{
const Dtype*data_pointer=this->blobs_[0]->gpu_data();

std::cout很明显,您正在访问cpu代码中的gpu_数据。您应该按以下方式打印数据:

const Dtype* data_pointer = this->blobs_[0]->cpu_data();
std::cout<<data_pointer[0]<<std::endl;
const Dtype*data\u pointer=this->blobs\u0]->cpu\u data();
标准::cout
*** Aborted at 1519149857 (unix time) try "date -d @1519149857" if you are    using GNU date ***
PC: @     0x7fe56e99c9df caffe::patchFieldLayer<>::Forward_gpu()
*** SIGSEGV (@0x10262a00000) received by PID 40338 (TID 0x7fe56f1d6ac0) from PID 1654652928; stack trace: ***
    @     0x7fe56d0da4b0 (unknown)
    @     0x7fe56e99c9df caffe::layer_name<>::Forward_gpu()
    @     0x7fe56e94f312 caffe::Net<>::ForwardFromTo()
    @     0x7fe56e94f427 caffe::Net<>::Forward()
    @     0x7fe56e7f2e9a caffe::Solver<>::Test()
    @     0x7fe56e7f385e caffe::Solver<>::TestAll()
    @     0x7fe56e7f397c caffe::Solver<>::Step()
    @     0x7fe56e7f44b6 caffe::Solver<>::Solve()
    @           0x40bc7f train()
    @           0x40772e main
    @     0x7fe56d0c5830 __libc_start_main
    @           0x4080b9 _start
Segmentation fault (core dumped)
const Dtype* data_pointer = this->blobs_[0]->cpu_data();
std::cout<<data_pointer[0]<<std::endl;