Ubuntu16.04+CUDA9.1+cudnn-..-v7环境安装caffe runtest出现问题
2017-12-27 15:49
471 查看
./include/caffe/test/test_gradient_check_util.hpp:175: Failure The difference between computed_gradient and estimated_gradient is 0.6739168052989799, which exceeds threshold_ * scale, where computed_gradient evaluates to 0.6739168052989799, estimated_gradient evaluates to 0, and threshold_ * scale evaluates to 0.01. debug: (top_id, top_data_id, blob_id, feat_id)=0,143,0,119; feat = 0.6739168052989799; objective+ = -0.037382097476710979; objective- = -0.037382097476710979 [ FAILED ] BatchReindexLayerTest/3.TestGradient, where TypeParam = caffe::GPUDevice<double> (1207 ms) ....... [----------] Global test environment tear-down [==========] 2123 tests from 281 test cases ran. (284030 ms total) [ PASSED ] 2122 tests. [ FAILED ] 1 test, listed below: [ FAILED ] BatchReindexLayerTest/3.TestGradient, where TypeParam = caffe::GPUDevice<double> 1 FAILED TEST Makefile:532: recipe for target 'runtest' failed make: *** [runtest] Error 1
错误如上面所示
不知道为什么别人好像没有这个错误
一个暂时的解决办法是将BatchReindexLayer的GPU版本中的forward和backward改回cpu执行
具体是将~/caffe/src/caffe/layers/batch_reindex_layer.cu修改为
#include <algorithm>
#include <utility>
#include <vector>
#include "caffe/layers/batch_reindex_layer.hpp"
#include "caffe/util/math_functions.hpp"
namespace caffe {
template<typename Dtype>
void BatchReindexLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
CHECK_EQ(1, bottom[1]->num_axes());
vector<int> newshape;
newshape.push_back(bottom[1]->shape(0));
for (int i = 1; i < bottom[0]->shape().size(); ++i) {
newshape.push_back(bottom[0]->shape()[i]);
}
top[0]->Reshape(newshape);
}
template<typename Dtype>
void BatchReindexLayer<Dtype>::check_batch_reindex(int initial_num,
int final_num,
const Dtype* ridx_data) {
for (int i = 0; i < final_num; ++i) {
CHECK_GE(ridx_data[i], 0)
<< "Index specified for reindex layer was negative.";
CHECK_LT(ridx_data[i], initial_num)
<< "Index specified for reindex layer was greater than batch size.";
}
}
template<typename Dtype>
void BatchReindexLayer<Dtype>::Forward_gpu(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
check_batch_reindex(bottom[0]->shape(0), bottom[1]->count(),
bottom[1]->cpu_data());
if (top[0]->count() == 0) {
return;
}
int inner_dim = bottom[0]->count() / bottom[0]->shape(0);
const Dtype* in = bottom[0]->cpu_data();
const Dtype* permut = bottom[1]->cpu_data();
Dtype* out = top[0]->mutable_cpu_data();
for (int index = 0; index < top[0]->count(); ++index) {
int n = index / (inner_dim);
int in_n = static_cast<int>(permut
);
out[index] = in[in_n * (inner_dim) + index % (inner_dim)];
}
}
template<typename Dtype>
void BatchReindexLayer<Dtype>::Backward_gpu(
const vector<Blob<Dtype>*>& top, const vector<bool>& propagate_down,
const vector<Blob<Dtype>*>& bottom) {
CHECK(!propagate_down[1]) << "Cannot backprop to index.";
if (!propagate_down[0]) {
return;
}
int inner_dim = bottom[0]->count() / bottom[0]->shape(0);
Dtype* bot_diff = bottom[0]->mutable_cpu_diff();
const Dtype* permut = bottom[1]->cpu_data();
const Dtype* top_diff = top[0]->cpu_diff();
caffe_set(bottom[0]->count(), Dtype(0), bot_diff);
for (int index = 0; index < top[0]->count(); ++index) {
int n = index / (inner_dim);
int in_n = static_cast<int>(permut
);
bot_diff[in_n * (inner_dim) + index % (inner_dim)] += top_diff[index];
}
}
INSTANTIATE_LAYER_GPU_FUNCS(BatchReindexLayer);
} // namespace caffe
希望能够帮助到大家,谢谢!
相关文章推荐
- 【机器学习自虐之旅】环境安装(一)Ubuntu 16.04 + NVidia-384 + CUDA 8.0 + cuDNN 6
- Ubuntu 16.04+CUDA 9.1+cuDNN v7+OpenCV 3.4.0+Caffe+PyCharm 完全安装指南,国内最全!(适用CUDA 9.0)
- Caffe深度学习入门——Ubuntu16.04 + CUDA9.1+cudnn7.5 + opencv3.3.1+python3.5+caffe安装参考博客和跳坑笔记
- Ubuntu16.04环境下安装CUDA、cudnn、Caffe、Tensorflow、pytorch
- ubuntu16.04+双显卡驱动+cuda9.1+cudnn7.05深度学习环境配置
- Ubuntu 16.04+CUDA 9.1+cuDNN v7+OpenCV 3.4.0+Caffe+PyCharm 完全安装指南,国内最全!(适用CUDA 9.0)
- 关于Ubuntu 16.04 安装CUDA和cuDnn环境变量的设置
- Ubuntu16.04安装cuda9.1+cuDNN7.1简明教程
- Ubuntu16.04安装cuda8.0,cudnn6.0,并在conda里安tensorflow1.3(与cuda8.0匹配),pycharm的gpu加速环境变量配置
- Ubuntu 16.04 深度学习环境快速安装(NVIDIA驱动+cuda+cuDNN)
- Nvidia 1050 ubuntu16.04 黑屏解决,CUDA+cudnn安装
- ubuntu 16.04 安装 tensorflow-gpu 包括 CUDA ,CUDNN,CONDA
- Ubuntu16.04 安装显卡驱动+cuda8.0+cudnn-v6+opecv2.4.13+caffe
- Ubuntu环境下深度学习cuda,cudnn,caffe,tensorflow的安装
- ubuntu 16.04 安装 tensorflow-gpu 包括 CUDA ,CUDNN,CONDA
- [深度学习]Ubuntu16.04 + GTX 1050 + cuda8.0 + cuDNN5.1 + caffe安装详解
- 半小时搭建 Ubuntu16.04 + CUDA8.0 + CUDNN5.0 + Caffe 环境
- Ubuntu 16.04lts 安装NVIDIA 私有驱动、cuda、cudnn、tensorflow-gpu等问题
- ubuntu 16.04安装nVidia显卡驱动和cuda/cudnn踩坑过程
- Ubuntu16.04安装gpu版tensorflow1.2+cuda+cudnn