Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Projecting a ZeroTangent onto a BlockDiagonal is Method-Ambiguous #84

Closed
SBuercklin opened this issue Dec 14, 2021 · 0 comments · Fixed by #85
Closed

Projecting a ZeroTangent onto a BlockDiagonal is Method-Ambiguous #84

SBuercklin opened this issue Dec 14, 2021 · 0 comments · Fixed by #85

Comments

@SBuercklin
Copy link

SBuercklin commented Dec 14, 2021

Attempting to ProjectTo a ZeroTangent from ChainRulesCore.jl onto a BlockDiagonal gives a method error, complaining that the operation is ambiguous:

using ChainRulesCore, BlockDiagonals

a = randn(2,2)
bd = BlockDiagonal([a,a])

julia> ProjectTo(bd)(ChainRulesCore.ZeroTangent())
# ERROR: MethodError: (::ProjectTo{BlockDiagonal, NamedTuple{(:blocks, :blocksizes), Tuple{Vector{ProjectTo{AbstractArray, NamedTuple{(:element, :axes), Tuple{ProjectTo{Float64, NamedTuple{(), Tuple{}}}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}}}}, Vector{Tuple{Int64, Int64}}}}})(::ZeroTangent) is ambiguous. Candidates:
#   (project::ProjectTo{BlockDiagonal})(dx) in BlockDiagonals at /home/sam/.julia/packages/BlockDiagonals/rUwoj/src/chainrules.jl:87
#   (::ProjectTo{T})(dx::AbstractZero) where T in ChainRulesCore at /home/sam/.julia/packages/ChainRulesCore/sHMAp/src/projection.jl:120
# Possible fix, define
#   (::ProjectTo{BlockDiagonal})(::AbstractZero)
# Stacktrace:
#  [1] top-level scope
#    @ REPL[6]:1

This was on 1.7.0 with the following environment:

(jl_vzzVL5) pkg> st                                                                                           
      Status `/tmp/jl_vzzVL5/Project.toml`
  [0a1fb500] BlockDiagonals v0.1.24
  [d360d2e6] ChainRulesCore v1.11.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant