Skip to content

Allow prep=nothing to stand for "no preparation" #814

Open
@MilesCranmer

Description

@MilesCranmer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions