FiniteDiff.jl icon indicating copy to clipboard operation
FiniteDiff.jl copied to clipboard

GradientCache typo?

Open anriseth opened this issue 7 years ago • 4 comments

The non-allocating GradientCache constructor has a line that calls eltype(df), but I can't see df anywhere in the arguments list?

https://github.com/JuliaDiffEq/DiffEqDiffTools.jl/blob/master/src/gradients.jl#L57 https://github.com/JuliaDiffEq/DiffEqDiffTools.jl/blob/master/README.md#allocating-cache-constructor

@dextorious / @ChrisRackauckas

anriseth avatar Feb 16 '18 02:02 anriseth

I also think that the c1 etc. should be passed on to GradientCache in these two functions. https://github.com/JuliaDiffEq/DiffEqDiffTools.jl/blob/master/src/gradients.jl#L108 https://github.com/JuliaDiffEq/DiffEqDiffTools.jl/blob/master/src/gradients.jl#L134

Or have I misunderstood something here?

anriseth avatar Feb 16 '18 02:02 anriseth

Hmm, I made a change to c1 but does it actually need to be required here?

ChrisRackauckas avatar Feb 16 '18 02:02 ChrisRackauckas

Hmm, I made a change to c1 but does it actually need to be required here?

Thanks. There's also a reference to df on this line https://github.com/JuliaDiffEq/DiffEqDiffTools.jl/blob/master/src/gradients.jl#L72 I don't know what is needed and not, but it seems like a test calling the non-allocating GradientCache must be missing if the tests pass?

BTW: We don't use these constructors and methods in Optim, so all is good from our side. I just thought I should mention that something looks weird here.

anriseth avatar Feb 16 '18 02:02 anriseth

Yeah, the tests are using the allocating cache. That last one was created hastily at the end it needs fixing. Optim shouldn't require either though since it should have an empty cache for R^n -> R gradients.

ChrisRackauckas avatar Feb 16 '18 02:02 ChrisRackauckas