Skip to content

AdjointStyle requires unnecessary AD boilerplate for wrapper transforms #135

@danielwe

Description

@danielwe

Certain transforms in the ecosystem, such as in FastTransforms.jl and ApproxFun.jl, are just wrappers that compose a basic FFT-like transform with additional scaling or another linear transform. See for example the ChebyshevTransformPlans at https://github.com/JuliaApproximation/FastTransforms.jl/blob/d8cceddd9e9b0829602c2a830de2588655754ea6/src/chebyshevtransform.jl and the JacobiTransformPlan at https://github.com/JuliaApproximation/ApproxFunOrthogonalPolynomials.jl/blob/f0426c65564ca2773114ee53a7082f9eaa2540cc/src/Spaces/Jacobi/jacobitransform.jl.

It should be possible to differentiate through these transforms by letting the AD framework do its job, as long as AD rules are defined for the inner transforms. However, the completely general rules defined in AbstractFFTs.jl require that an AdjointStyle and a corresponding implementation of adjoint_mul be defined for every single subtype of AbstractFFTs.Plan, implying a lot of boilerplate and lots of potential bugs.

Could one imagine a redesign where the AD rules in AbstractFFTs.jl only apply to plans that actually define the AbstractStyle trait, while the AD framework gets to do its thing for other transform types?

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