JuliaDiff / JuliaDiff/DifferentiationInterface.jl

Allow `prep=nothing` to stand for "no preparation"

Open
#814 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

core
Dominant language
Julia
Stars
313
Forks
35
PR merge metrics
No merged PRs in 30d

Description

Tiny tiny thing.... So, I have some internal methods that process and cache prep for a gradient call. Right now I have to do this at the call site:

(val, grad) = if isnothing(prep)
    value_and_gradient(f, backend, tree)
else
    value_and_gradient(f, prep, backend, tree)
end

I think I would enjoy if DifferentiationInterface.jl did this routing for me. If prep=nothing I think it should be semantically identical to not passing prep at all.

Contributor guide

Open the contributing guide

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 locating the value_and_gradient entry points that accept prep and review how prepared and unprepared calls are tested. Add coverage showing that prep=nothing has the same behavior as omitting prep, then run the existing test suite to verify both routing paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.