wangxiao@wangxiao-GTX980:~/Downloads/caffe-master$ make -j8
find: `wangxiao/bvlc_alexnet/spl': No such file or directory
find: `caffemodel': No such file or directory
find: `wangxiao/bvlc_alexnet/0.77': No such file or directory
find: `caffemodel': No such file or directory
NVCC src/caffe/layers/euclidean_loss_layer.cu
src/caffe/layers/euclidean_loss_layer.cu(41): error: a value of type "const float *" cannot be used to initialize an entity of type "float *"
          detected during instantiation of "void caffe::EuclideanLossLayer<Dtype>::Backward_gpu(const std::vector<caffe::Blob<Dtype> *, std::allocator<caffe::Blob<Dtype> *>> &, const std::vector<__nv_bool, std::allocator<__nv_bool>> &, const std::vector<caffe::Blob<Dtype> *, std::allocator<caffe::Blob<Dtype> *>> &) [with Dtype=float]"
(140): here

src/caffe/layers/euclidean_loss_layer.cu(42): error: a value of type "const float *" cannot be used to initialize an entity of type "float *"
          detected during instantiation of "void caffe::EuclideanLossLayer<Dtype>::Backward_gpu(const std::vector<caffe::Blob<Dtype> *, std::allocator<caffe::Blob<Dtype> *>> &, const std::vector<__nv_bool, std::allocator<__nv_bool>> &, const std::vector<caffe::Blob<Dtype> *, std::allocator<caffe::Blob<Dtype> *>> &) [with Dtype=float]"
(140): here

src/caffe/layers/euclidean_loss_layer.cu(41): error: a value of type "const double *" cannot be used to initialize an entity of type "double *"
          detected during instantiation of "void caffe::EuclideanLossLayer<Dtype>::Backward_gpu(const std::vector<caffe::Blob<Dtype> *, std::allocator<caffe::Blob<Dtype> *>> &, const std::vector<__nv_bool, std::allocator<__nv_bool>> &, const std::vector<caffe::Blob<Dtype> *, std::allocator<caffe::Blob<Dtype> *>> &) [with Dtype=double]"
(140): here

src/caffe/layers/euclidean_loss_layer.cu(42): error: a value of type "const double *" cannot be used to initialize an entity of type "double *"
          detected during instantiation of "void caffe::EuclideanLossLayer<Dtype>::Backward_gpu(const std::vector<caffe::Blob<Dtype> *, std::allocator<caffe::Blob<Dtype> *>> &, const std::vector<__nv_bool, std::allocator<__nv_bool>> &, const std::vector<caffe::Blob<Dtype> *, std::allocator<caffe::Blob<Dtype> *>> &) [with Dtype=double]"
(140): here

4 errors detected in the compilation of "/tmp/tmpxft_000007e5_00000000-16_euclidean_loss_layer.compute_50.cpp1.ii".
make: *** [.build_debug/cuda/src/caffe/layers/euclidean_loss_layer.o] Error 1
wangxiao@wangxiao-GTX980:~/Downloads/caffe-master$

----------------------------------------------------------------------

----------------------------------------------------------------------

原因分析:

主要是因为,在欧式距离损失函数中,我增添了以下两句话:

Dtype* diff_cpu_data = bottom[i]->mutable_cpu_diff();
       Dtype* label_data = bottom[1]->cpu_data();    // label data: 0 or 1
       Dtype* predict_data = bottom[0]->cpu_data();  // predict data

再来看看提示的错误:

src/caffe/layers/euclidean_loss_layer.cu(41): error: a value of type "const float *" cannot be used to initialize an entity of type "float *"
         
detected during instantiation of "void
caffe::EuclideanLossLayer<Dtype>::Backward_gpu(const
std::vector<caffe::Blob<Dtype> *,
std::allocator<caffe::Blob<Dtype> *>> &, const
std::vector<__nv_bool, std::allocator<__nv_bool>> &,
const std::vector<caffe::Blob<Dtype> *,
std::allocator<caffe::Blob<Dtype> *>> &) [with
Dtype=float]"
(140): here

src/caffe/layers/euclidean_loss_layer.cu(42): error: a value of type "const float *" cannot be used to initialize an entity of type "float *"
         
detected during instantiation of "void
caffe::EuclideanLossLayer<Dtype>::Backward_gpu(const
std::vector<caffe::Blob<Dtype> *,
std::allocator<caffe::Blob<Dtype> *>> &, const
std::vector<__nv_bool, std::allocator<__nv_bool>> &,
const std::vector<caffe::Blob<Dtype> *,
std::allocator<caffe::Blob<Dtype> *>> &) [with
Dtype=float]"
(140): here

肯定是少了 const 约束:

so , 改为:

const Dtype* label_data = bottom[1]->cpu_data();    // label data: 0 or 1
const Dtype* predict_data = bottom[0]->cpu_data();  // predict data

在编译,就ok啦 ~~

2. 问题2:

CXX src/caffe/layers/accuracy_layer.cpp
src/caffe/layers/accuracy_layer.cpp: In instantiation of ‘void caffe::AccuracyLayer<Dtype>::Forward_cpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&) [with Dtype = float]’:
src/caffe/layers/accuracy_layer.cpp:286:1:   required from here
src/caffe/layers/accuracy_layer.cpp:98:21: error: assignment of read-only location ‘*(bottom_data + 84u)’
     bottom_data[21] = 1; bottom_data[22] = 0; bottom_data[23] = 0; bottom_data[24] = 0;

看到错误就应该知道:错误的原因是给只读的变量赋值了。。。

但是,又想改变那个值,来作为最后求解的结果,怎么办呢? 好吧,那就只好先将该变量存到一个中间变量里面去了,但是,问题又来了,原本const 的变量可以赋值给普通的变量么?

例如: float a = const float b ? 这样ok么?我觉得不ok,先试试吧。。。

caffe: fuck compile error again : error: a value of type "const float *" cannot be used to initialize an entity of type "float *"的更多相关文章

  1. ubuntu下安装pandas出现 compile failed with error code 1 in /tmp/pip_build_hadoop/pandas

    都是用pip装的,是不是应该用apt-get 装的呀 ubuntu下安装pandas (出现 compile failed with error code 1 in /tmp/pip_build_ha ...

  2. Inceptor [Code: 40000, SQL State: 42000] COMPILE FAILED: Internal error NullPointerException: [Error 40000] java.lang.NullPointerException

    下面代码报空指针 with `__all_dim__` as ( select * from ( select from_unixtime(unix_timestamp(`__bts__`) -1,' ...

  3. fatal error C1189: #error : core.hpp header must be compiled as C++

    两次opencv工程需要设置为C++编译:找了一半天的解决方法. I am building a C application that uses OpenCV. when compiling, I g ...

  4. AndroidStudio与eclipse打包的时候报错。Error:(4) Error: "ssdk_instapager_login_html" is not translated in "en"

    作者:程序员小冰,CSDN博客:http://blog.csdn.net/qq_21376985 QQ986945193 博客园主页:http://www.cnblogs.com/mcxiaobing ...

  5. sqoop:Failed to download file from http://hdp01:8080/resources//oracle-jdbc-driver.jar due to HTTP error: HTTP Error 404: Not Found

    环境:ambari2.3,centos7,sqoop1.4.6 问题描述:通过ambari安装了sqoop,又添加了oracle驱动配置,如下: 保存配置后,重启sqoop报错:http://hdp0 ...

  6. MDK st-link下载STM32程序出现Internal command error和Error:Flash download failed. Target DLL

    MDK st-link下载STM32程序出现Internal command error和Error:Flash download failed. Target DLL   是因为目标板的芯片处于休眠 ...

  7. Android Studio Error:CreateProcess error=216

    Error:CreateProcess error=216, This version of %1 is not compatible with the version of Windows you' ...

  8. mysql [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist (转载)

    mysql报错Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 2013-11-2 ...

  9. [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

    mysql 启动总是报错: 错误日志中显示: [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' ...

随机推荐

  1. 《JAVA笔记 day08 静态_单例》

    //static关键字: /* 静态方法的使用注意事项: 1,静态方法不能访问非静态的成员. 但是非静态是可以访问静态成员的. 说明:静态的弊端在于访问出现了局限性.好处是可以直接别类名调用. 2,静 ...

  2. 一篇介绍jquery中的ajax的结合

    <script type="text/javascript">        function Text_ajax()        {           $.aja ...

  3. Unix/Linux获取进程的详细信息

    Linux的进程的信息都记录在/proc/<pid>/下面,其实常用的ps.top命令也是从这里读取信息的.常用的信息有: cmd(命令).cmdline(完整的命令行参数).envrio ...

  4. 预编译 .pch文件

    如果工程导入了其他编程语言文件混编的时候   .pch文件会在程序开始的时候导入所有头文件,需要 '预编写命令' 区分编程语言的头文件. 下面报错就是因为工程导入了.c 文件   .pch全局导入了O ...

  5. 走进科学之WAF(Web Appllication Firewall)篇

    小编P.S:文章非常详尽对WAF领域进行了一次科普,能有让人快速了解当前WAF领域的相关背景及现状,推荐所有WAF领域的同学阅读本文. 1. 前言 当WEB应用越来越为丰富的同时,WEB 服务器以其强 ...

  6. (转)Sencha Touch和jQuery Mobile的比较

    原文:http://extjs.org.cn/node/664 Sencha Touch和jQuery Mobile的比较 Posted 周三, 08/07/2013 - 10:07 by admin ...

  7. Http Framework

    http request clientVolley https://android.googlesource.com/platform/frameworks/volley聚划算用的litehttp h ...

  8. hdu 2092

    Ps:wa了两次....一次是从加法那边暴力,然而算法错误..应该从乘法那边暴力破解...然而又没算负数..加上负数..直接暴力AC. 代码: #include "stdio.h" ...

  9. 永不消逝的电波(三):低功耗蓝牙(BLE)入门之如何调戏别人的小米手环

    0×00 前言 蓝牙(Bluetooth),一种无线技术标准,用来让固定与移动设备,在短距离间交换数据,以形成个人局域网(PAN).其使用短波特高频(UHF)无线电波,经由2.4至2.485 GHz的 ...

  10. MySQL数据库系统概述

    了解MySQL数据库管理系统,内容如下:   一.基于数据库的PHP项目       目前动态网站都是基于数据库,将网站内容使用数据库管理系统去管理       用户, 栏目, 图片, 文章, 评论都 ...