Caffe 中类似函数的宏(如 CHECK & CHECK_EQ)的定义究竟在哪里?
Where is exactly the definition of function-like macros such as CHECK & CHECK_EQ in Caffe?
正如我所注意到的,有很多类似函数的宏,如CHECK
、CHECK_EQ
。。。它经常用于Caffe头文件和源文件,例如在blob.cpp中,我们有:
template <typename Dtype>
void Blob<Dtype>::FromProto(const BlobProto& proto, bool reshape) {
if (reshape) {
vector<int> shape;
if (proto.has_num() || proto.has_channels() ||
proto.has_height() || proto.has_width()) {
// Using deprecated 4D Blob dimensions --
// shape is (num, channels, height, width).
shape.resize(4);
shape[0] = proto.num();
shape[1] = proto.channels();
shape[2] = proto.height();
shape[3] = proto.width();
} else {
shape.resize(proto.shape().dim_size());
for (int i = 0; i < proto.shape().dim_size(); ++i) {
shape[i] = proto.shape().dim(i);
}
}
Reshape(shape);
} else {
CHECK(ShapeEquals(proto)) << "shape mismatch (reshape not set)";
}
// copy data
Dtype* data_vec = mutable_cpu_data();
if (proto.double_data_size() > 0) {
CHECK_EQ(count_, proto.double_data_size());
for (int i = 0; i < count_; ++i) {
data_vec[i] = proto.double_data(i);
}
} else {
CHECK_EQ(count_, proto.data_size());
for (int i = 0; i < count_; ++i) {
data_vec[i] = proto.data(i);
}
}
if (proto.double_diff_size() > 0) {
CHECK_EQ(count_, proto.double_diff_size());
Dtype* diff_vec = mutable_cpu_diff();
for (int i = 0; i < count_; ++i) {
diff_vec[i] = proto.double_diff(i);
}
} else if (proto.diff_size() > 0) {
CHECK_EQ(count_, proto.diff_size());
Dtype* diff_vec = mutable_cpu_diff();
for (int i = 0; i < count_; ++i) {
diff_vec[i] = proto.diff(i);
}
}
这些宏的定义究竟在哪里?
这些宏是caffe正在使用的Google glog
日志库的一部分。
相关文章:
- CHECK(调用)函数在Google Colab中出错
- 'make check' GLIBC 运行时的链接问题
- 为什么我会收到"Run-Time Check Failure #2 - Stack around the variable 'pr' was corrupted"错误?
- rpmbuild check-rpath 报告错误,指出路径不是绝对的,不正确的
- 调用 dll 函数时"Run-Time Check Failure #0 - The value of ESP"
- 在创建完整对象之前编写 if-can-add check 方法的正确方法?
- "check if member exists using enable_if"中修改的代码不起作用
- Bison-3.0.4 中的 Linux 从头开始错误 'make check'
- SQL Server 2016 CLR 存储过程错误:"A system assertion check has failed"
- Linux Pybind11 'build check -j 4' 错误
- 十六进制值的SQLITE CHECK约束
- C++ - 我使用哪个编译器来使自动 eq = [ ](..) 语法工作?
- 我找不到程序中的歧义,但编译器说 check(int) 和 check(float) 之间存在歧义
- Check Writer:使程序将值10-19显示为单词
- Arduino to Raspberry crc32 check
- 要求基类运算符执行"domain check" (C++)
- "please check gdb is codesigned - see taskgated(8)" - 如何安装带有自制代码签名的gdb?
- Check CRL OpenSSL C
- 自动配置/自动生成:如何避免将"check"选项传递给AC_CONFIG_SUBDIRS
- 如何让 gdb 从 icc '-check-pointers=write' 中断"CHKP: Bounds check error"