JuliaDiff / JuliaDiff/FiniteDifferences.jl

ChainRules types in FiniteDifferences to replace to_vec

Open
#97 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
318
Forks
32
PR merge metrics
No merged PRs in 30d

Description

As suggested in https://github.com/JuliaDiff/FiniteDifferences.jl/issues/90#issuecomment-650078638 , we might want to consider moving away from to_vec towards defining operations on ChainRules's types directly.

In particular #91 implements the difference operation, which is the only operation that we're missing to let us approximately compute tangents. Still TODO is

  1. determine how to compute cotangents within this framework + implement it, and
  2. determine whether or not we require some notion of a Jacobian (probably we do) and implement it, and
  3. define the norm of a differential, from which we get isapprox for free if we also define subtraction, which is really easy because we've already defined addition and scalar multiplication. I think we can do this because I think we can always derive an appropriate norm for a differential, that is, I think we can treat any given differential as being an element of an appropriate normed vector space. (Note that we've not defined inner products between differentials, and I don't think we need to. Doing so would be one way to go about defining a norm, but it probably makes sense to go straight to a norm if we can't think of a reason why would need to define inner products. I'm open to suggestions here.) This is something we'll need to sort out in ChainRulesCore, as per https://github.com/JuliaDiff/ChainRulesCore.jl/issues/184.

Implementing this will immediately resolve:

  1. #92
  2. https://github.com/JuliaDiff/ChainRulesTestUtils.jl/issues/24 as it is covered by difference already

but will generally significantly improve the compatibility between ChainRuless and FiniteDifferences, and should make one's experience testing differentials a much more pleasant experience.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the ChainRules types and the difference operation from #91, then read ChainRulesCore issue #184 for the unresolved norm and subtraction design. Determine how cotangents and Jacobians should work, implement the missing operations, and verify that #92 and ChainRulesTestUtils issue #24 are resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.