Comments (3)
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.
This now fixed on master
as of the merging of #27.
from forwarddiff.jl.
👍
from forwarddiff.jl.
Related Issues (20)
- AD in-place instead of broadcast HOT 1
- Is the mutating code the problem here? How could I debug this? HOT 2
- Rationals and Modulo
- `NaNMath` (and `SpecialFunctions`) as extensions? HOT 5
- Broken external link
- `construct_seeds` for types where `typeof(one(T)) !=T` is broken HOT 1
- incorrect 2nd derivative of complex exponential HOT 2
- Can you take derivative of complicated function whose symbolic form is not explicit or not known?
- Cancellation with sparse arrays HOT 5
- Implement hessian! for scalar x
- Implement gammalogccdf for ForwardDiff HOT 1
- `ForwardDiff.jacobian` throws error for `fft` HOT 1
- Correctly forming nested dual numbers. HOT 8
- Derivative of a function of derivatives HOT 7
- Symbolics.jl compatibility HOT 1
- Support derivative(f, ::Complex)
- `ForwardDiff` fails to compute correct derivative HOT 3
- Incorrect Hessian by `exp` function HOT 1
- Method ambiguities reported by Aqua HOT 3
- Document internals? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from forwarddiff.jl.