CHECK_*()宏定义的作用-caffe

本文详细解析了Caffe源码中的条件检查宏,包括CHECK_EQ、CHECK_NE、CHECK_LE、CHECK_LT、CHECK_GE和CHECK_GT。这些宏用于进行等值、不等值、小于等于、小于、大于等于及大于的条件判断,并在条件不满足时输出相应的错误信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 个人在学习caffe源码文件时遇到了CHECK_EQ函数,不理解什么含义,经过上下文理解,明白了其中含义。

  CHECK_EQ(x,y)<<"x!=y",EQ即equation,意为“等于”,函数判断是否x等于y,当x!=y时,函数打印出x!=y。

  CHECK_NE(x,y)<<"x=y",NE即not equation,意为“不等于”,函数判断是否x不等于y,当x=y时,函数打印出x=y。

  CHECK_LE(x,y) <<"x>=y",LE即lower equation,意为小于等于,函数判断是否x小于等于y。当x>=y时,函数打印x>=y。

  CHECK_LT(x,y)<<"x>=y",LT即为lower to ,意为小于,函数判断是否x小于y,当x>y时,函数打印x>y。

  CHECK_GE(x,y) <<"x<=y",GE即为great equation,意为大于。判断意义根据上述可推导出。

  CHECK_GT(x,y) <<"x<=y",同理如上。

(openpose) root@cnshaw2404:~/Workspace/openpose/build# cmake .. -DBUILD_PYTHON=true -DUSE_CUDNN=off -- The C compiler identification is GNU 10.5.0 -- The CXX compiler identification is GNU 10.5.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- GCC detected, adding compile flags -- GCC detected, adding compile flags -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Found CUDA: /usr/local/cuda-11.8 (found version "11.8") -- Building with CUDA. -- CUDA detected: 11.8 -- Added CUDA NVCC flags for: sm_86 -- cuDNN not found -- Found GFlags: /usr/include -- Found gflags (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so) -- Found Glog: /usr/include -- Found glog (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libglog.so) CMake Warning at /root/miniconda3/envs/openpose/share/cmake-3.24/Modules/FindProtobuf.cmake:524 (message): Protobuf compiler version 3.20.3 doesn't match library version 3.21.12 Call Stack (most recent call first): CMakeLists.txt:429 (find_package) -- Found Protobuf: /usr/local/lib/libprotobuf.so (found version "3.21.12") -- Found OpenCV: /usr (found version "4.6.0") -- Caffe will be downloaded from source now. NOTE: This process might take several minutes depending on your internet connection. -- Caffe has already been downloaded. Previous HEAD position was b5ede488 Added TX2 JetPack3.3 support HEAD is now at 1807aada Added Ampere arch's (CUDA11) -- Caffe will be built from source now. -- Download the models. -- Downloading BODY_25 model... -- Model already exists. -- Not downl
最新发布
03-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值