Caffe段分割编译错误

时间:2018-07-13 19:26:43

标签: makefile ubuntu-16.04 caffe

我在编译caffe-segnet时遇到此错误。 这是我使用时的终端  〜/ .local / install / caffe-segnet $全部完成

CXX src/caffe/layers/contrastive_loss_layer.cpp
src/caffe/layers/contrastive_loss_layer.cpp: In instantiation of ‘void caffe::ContrastiveLossLayer<Dtype>::Forward_cpu(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&) [with Dtype = float]’:
src/caffe/layers/contrastive_loss_layer.cpp:118:1:   required from here
src/caffe/layers/contrastive_loss_layer.cpp:56:30: error: no matching function for call to ‘max(double, float)’
         Dtype dist = std::max(margin - sqrt(dist_sq_.cpu_data()[i]), Dtype(0.0));
                              ^
In file included from /usr/include/c++/5/algorithm:61:0,
                 from src/caffe/layers/contrastive_loss_layer.cpp:1:
/usr/include/c++/5/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/5/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
src/caffe/layers/contrastive_loss_layer.cpp:56:30: note:   deduced conflicting types for parameter ‘const _Tp’ (‘double’ and ‘float’)
         Dtype dist = std::max(margin - sqrt(dist_sq_.cpu_data()[i]), Dtype(0.0));
                              ^
In file included from /usr/include/c++/5/algorithm:61:0,
                 from src/caffe/layers/contrastive_loss_layer.cpp:1:
/usr/include/c++/5/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/5/bits/stl_algobase.h:265:5: note:   template argument deduction/substitution failed:
src/caffe/layers/contrastive_loss_layer.cpp:56:30: note:   deduced conflicting types for parameter ‘const _Tp’ (‘double’ and ‘float’)
         Dtype dist = std::max(margin - sqrt(dist_sq_.cpu_data()[i]), Dtype(0.0));
                              ^
Makefile:526: recipe for target '.build_release/src/caffe/layers/contrastive_loss_layer.o' failed
make: *** [.build_release/src/caffe/layers/contrastive_loss_layer.o] Error 1

1 个答案:

答案 0 :(得分:0)

我也有同样的问题。您是否正在使用Windows分支来构建Caffe?