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

grad requires a scalar-valued function #67

Closed
fatihtalu opened this issue Mar 20, 2018 · 2 comments
Closed

grad requires a scalar-valued function #67

fatihtalu opened this issue Mar 20, 2018 · 2 comments

Comments

@fatihtalu
Copy link

Does not it have to be the solution [ [2 0] [0 2] ] ?

q

@CarloLucibello
Copy link
Collaborator

as the error says, autograd requires scalar valued functions, and df is not. To obtain the hessian for your example you can use

julia> g=grad(f)
(::gradfun) (generic function with 1 method)

julia> ddf(w)= [grad(x->g(x)[1])(w) grad(x->g(x)[2])(w)]
ddf (generic function with 1 method)

julia> ddf(w)
2×2 Array{Int64,2}:
 2  0
 0  2

Also see #54

@fatihtalu
Copy link
Author

Perfect! exactly as I want.
Thanks CarloLucibello.

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

2 participants