Open danielnjoo opened 7 years ago
Have the same issue!
Have you solved this ? I met the same error
If anyone still wondering, just go into the file and add float() to the variables should get rid of this.
Replace line 56 by this one :
Dtype dist = std::max(margin - (float)sqrt(dist_sq_.cpu_data()[i]), Dtype(0.0));
Dtype dist = std::max(margin - (double)sqrt(distsq.cpu_data()[i]), 0.0);
OS: Ubuntu 17.04
Thanks for any help :)
Compilation worked (after commenting out add_subdirectory line for examples), but running into errors with building:
[ 14%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/concat_layer.cpp.o [ 16%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/contrastive_loss_layer.cpp.o /home/daniel/Desktop/cats/hed/src/caffe/layers/contrastive_loss_layer.cpp: In instantiation of ‘void caffe::ContrastiveLossLayer::Forward_cpu(const std::vector<caffe::Blob>&, const std::vector<caffe::Blob >&) [with Dtype = float]’:
/home/daniel/Desktop/cats/hed/src/caffe/layers/contrastive_loss_layer.cpp:118:1: required from here
/home/daniel/Desktop/cats/hed/src/caffe/layers/contrastive_loss_layer.cpp:56:30: error: no matching function for call to ‘max(float, double)’
Dtype dist = std::max(margin - sqrt(distsq.cpu_data()[i]), 0.0);