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

MethodError: objects of type L2DistLoss are not callable #138

Closed
ShuhuaGao opened this issue Feb 6, 2021 · 2 comments
Closed

MethodError: objects of type L2DistLoss are not callable #138

ShuhuaGao opened this issue Feb 6, 2021 · 2 comments

Comments

@ShuhuaGao
Copy link

When following the get started guide, I encountered the error below:

julia> using LossFunctions

julia> loss = L2DistLoss()
L2DistLoss()

julia> loss(1, 0.5f0)
ERROR: MethodError: objects of type L2DistLoss are not callable
Stacktrace:
 [1] top-level scope
   @ REPL[6]:1

version:

  • Julia Version 1.6.0-beta1.0
  • LossFunctions v0.6.2
@barucden
Copy link
Member

It seems that the loss types are not callable now. Is it intentional?

Meanwhile, you can make it callable

julia> using LossFunctions

julia> (l::Loss)(targets, outputs) = value(l, targets, outputs)

julia> loss = L2DistLoss()
LPDistLoss{2}()

julia> loss(1, 0.5f0)
0.25f0

@juliohm
Copy link
Member

juliohm commented May 22, 2022

The functional form works fine with vectors as arguments loss([1,2,3], [4,5,6])

@juliohm juliohm closed this as completed May 22, 2022
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