as noticed, there lots of function-like macros such check
, check_eq
, ... used in caffe headers , source files, example in blob.cpp have:
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 (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()); (int = 0; < 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()); (int = 0; < count_; ++i) { data_vec[i] = proto.double_data(i); } } else { check_eq(count_, proto.data_size()); (int = 0; < 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(); (int = 0; < 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(); (int = 0; < count_; ++i) { diff_vec[i] = proto.diff(i); } }
where definition of these macros?
these macros part of google's glog
logging library caffe using.
Comments
Post a Comment