Skip to content

StaticArrays adjoint constructor #570

@martinhath

Description

@martinhath

I'm trying to use Zygote.jl together with StaticArrays.jl, but am getting an error message I don't understand. Here's a very minimal example

julia> gradient(n->SMatrix{1,1}(n)[1], 1)
ERROR: Need an adjoint for constructor SArray{Tuple{1,1},Int64,2,1}. Gradient is of type MArray{Tuple{1,1},Int64,2,1}

I have tried to add adjoints, but I don't understand for which type the constructor should be for, take in, and whether the type of the delta matters. None of the adjoints I've tried to define helps, so there's obviously things I don't understand here. It is also very confusing that the error message mentions MArray when I've gone out of my way of avoiding mutable arrays, since Zygote doesn't support that.

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