Giter Club home page Giter Club logo

Comments (3)

jrevels avatar jrevels commented on May 22, 2024

That does indeed look like a bug on our end, thanks for filing!

This package is undergoing a huge refactor at the moment, explained in this comment here. This bug will be fixed once #27 is merged (hopefully within the next 2 weeks). Here's some example code, working directly from the nduals-refactor branch:

julia> using ForwardDiff

julia> f1(s) = (s/3)^2
f1 (generic function with 1 method)

julia> f2(s, l) = s^2 + exp(3*l/sqrt(4))
f2 (generic function with 1 method)

julia> function f(x)
                  return f1(x[1]) + f2(x[1], x[2])
              end
f (generic function with 1 method)

julia> g = gradient_func(f, Partials{2,Float64}, mutates=false)
gradf (generic function with 1 method)

julia> g([0.1, 56.2])
2-element Array{Float64,1}:
 0.222222
 6.12514e36

In the meantime, you could try changing this line in the code you posted:

julia> g = forwarddiff_gradient(f, Float64)

to this:

julia> g = forwarddiff_gradient(f, Float64, fadtype=:typed, n=2)

and that should work as a temporary fix.

from forwarddiff.jl.

jrevels avatar jrevels commented on May 22, 2024

This now fixed on master as of the merging of #27.

from forwarddiff.jl.

ovainola avatar ovainola commented on May 22, 2024

👍

from forwarddiff.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.