Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contrastive_loss_layer.cpp has a very little bug (I think) #128

Open
SuaiChen opened this issue Jan 5, 2018 · 2 comments
Open

contrastive_loss_layer.cpp has a very little bug (I think) #128

SuaiChen opened this issue Jan 5, 2018 · 2 comments

Comments

@SuaiChen
Copy link

SuaiChen commented Jan 5, 2018

I met an error just like below:

src/caffe/layers/contrastive_loss_layer.cpp:56:22: error: no matching function for call to 'max'
        Dtype dist = std::max(margin - sqrt(dist_sq_.cpu_data()[i]), 0.0);
                     ^~~~~~~~
src/caffe/layers/contrastive_loss_layer.cpp:118:19: note: in instantiation of member function 'caffe::ContrastiveLossLayer<float>::Forward_cpu' requested here
INSTANTIATE_CLASS(ContrastiveLossLayer);
                  ^
/Library/Developer/CommandLineTools/usr/include/c++/v1/algorithm:2611:1: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('float' vs. 'double')
max(const _Tp& __a, const _Tp& __b)
^
/Library/Developer/CommandLineTools/usr/include/c++/v1/algorithm:2603:1: note: candidate function template not viable: requires 3 arguments, but 2 were provided
max(const _Tp& __a, const _Tp& __b, _Compare __comp)

I revised the 56th row.

Dtype dist = std::max(margin - sqrt(dist_sq_.cpu_data()[i]), Dtype(0.0));

And it can work. My computer is Macpro and my system version is 10.13.1.

@qxandy
Copy link

qxandy commented Mar 6, 2018

Met the same problem. Just followed your solution. Maybe the Dtype() is forgotten, as is shown in line 54 in the same file.

@qu1j0t3
Copy link

qu1j0t3 commented Mar 11, 2018

Yes, previously referenced here: #124 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants