Skip to content

MethodError: (::ProjectTo{NoTangent, @NamedTuple{}})(::Thunk) is ambiguous #685

@cossio

Description

@cossio
julia> using Zygote, ChainRules, ChainRulesCore

julia> x = BitArray([0])
julia> _, back = rrule(AbstractArray{Float64}, x)
julia> (::ProjectTo{NoTangent})(::AbstractThunk) = NoTangent()

julia> back([1.0])
(NoTangent(), NoTangent())

julia> back(@thunk([1.0]))
ERROR: MethodError: (::ProjectTo{NoTangent, @NamedTuple{}})(::Thunk{var"#1#2"}) is ambiguous.

CC @oxinabox @mcabbott @ToucheSir

From a conversation on Slack, the fix seems to be to define the method:

(::ProjectTo{NoTangent}(::Thunk) = NoTangent()

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