Skip to content

StaticArrays need opt-in friendly tangent type for Mooncake #998

@yebai

Description

@yebai

DI/DIT requires the following Mooncake opt-in for its StaticArrays-related tests to pass:

function Mooncake.friendly_tangent_cache(x::StaticArray)
    return Mooncake.FriendlyTangentCache{Mooncake.AsPrimal}(copy(x))
end

With this in place, DI’s full test suite passes for Mooncake. That said, it is somewhat unusual that StaticArrays are included as part of DI’s core test suite, since they are not universally supported across AD backends.

DI currently states:

Thorough validation on standard inputs and outputs (numbers, vectors, matrices)

This phrasing is overly broad. In practice, support depends on specific concrete subtypes of Number, AbstractVector, and AbstractMatrix. For instance, Mooncake does not currently support differentiation with BigFloat or Vector{BigFloat}, and similar limitations likely exist for other AD backends.

Related: SciML/ComponentArrays.jl#350

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