JuliaDiff / JuliaDiff/ChainRules.jl

Can rules make decisions based on which primal method is used?

Open
#237 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

design type constraints
Dominant language
Julia
Stars
475
Forks
98
PR merge metrics
No merged PRs in 30d

Description

Can we safely detect if a primal function is going to hit a specific default and use that to change the logic in the frule or rrule?

For example, the rrule for det(A) calls inv(A). If we know that the primal function that would be hit is the det(A::AbstractMatrix) definition in generic.jl, then we know that the primal is using the lu decomposition to compute the determinant, and we can reuse that to compute the inverse faster. But if a specialized primal method was being hit, then we probably just want to call the primal and invert separately since that primal is probably more efficient for that type than lu.

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 reading generic.jl and the existing det(A) rrule and inv-related logic, then investigate whether Julia method dispatch can safely expose which primal method will run. Done would require a decided, tested approach for distinguishing the generic det path from specialized primal methods.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
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.