如何在咖啡中Forward_gpu期间打印变量
How to print variables during Forward_gpu in caffe
我试图在函数Forward_gpu打印底部形状和底部数据。但它会导致段故障。有人可以告诉我正确的方法以及我遇到段错误的原因吗?
我做了:
void Forward_gpu(const vector<Blob<Dtype> *> &bottom, const vector<Blob<Dtype> *> &top)
{
...
puts("bottom shape: ");
std::cout << bottom[2*i]->gpu_shape()[0] << std::endl;
...
}
我得到了什么:
bottom shape:
*** Aborted at 1500362213 (unix time) try "date -d @1500362213" if you are using GNU date ***
PC: @ 0x7fe4be27cbfd caffe::DeformableConvolutionLayer<>::Forward_gpu()
*** SIGSEGV (@0x1020d602c00) received by PID 17153 (TID 0x7fe4bea969c0) from PID 224406528; stack trace: ***
@ 0x7fe4bc615cb0 (unknown)
@ 0x7fe4be27cbfd caffe::DeformableConvolutionLayer<>::Forward_gpu()
@ 0x7fe4be204471 caffe::Net<>::ForwardFromTo()
@ 0x7fe4be2047e7 caffe::Net<>::ForwardPrefilled()
@ 0x7fe4be224455 caffe::Solver<>::Step()
@ 0x7fe4be224d59 caffe::Solver<>::Solve()
@ 0x4084be train()
@ 0x405cac main
@ 0x7fe4bc600f45 (unknown)
@ 0x40647d (unknown)
@ 0x0 (unknown)
Segmentation fault (core dumped)
你必须像这样访问它们
bottom[2*i]->shape(0)
并确保 2*i 在可用底部的范围内,首先尝试使用
bottom[0]->shape(0)
确保至少你可以让它打印出来
相关文章:
- 如何循环打印顶点结构
- 为什么在popback()操作之后,它仍然打印完整的矢量
- 如何在c++中打印目录
- 有一个打印语句的函数是一种糟糕的编程实践吗
- 在线编译器中的分段C++没有打印消息
- 在C++中打印指向不同基元数据类型的指针的内存地址
- 这个指针和内存代码打印是什么?我不知道是打印垃圾还是如何打印我需要的值
- 如何将结构插入到集合中并打印集合的成员
- 在循环C++中指定字符串之后,不会打印该字符串
- 以螺旋方式打印矩阵的程序.(工作不好)
- 从控制台中删除最后打印的元素
- 如何使用Crypto++并为RSA返回可打印的字节/字符数组
- 如何仅使用对象名称打印特定于对象的成员
- 回溯C++不打印函数,因此文件
- 在一定长度后从数组中打印时缺少整数
- 为什么这个 c++ 代码打印出长度 5,当我打印出字符串时,程序会自动终止?
- 在gem5中打印文件中的所有cache_blocks
- 打印数字图案
- Log4cpp:以UTC/GMT时区打印日期
- 如何使用gdb制作一个可以漂亮地打印每个对象的C++函数