Skip to content

Commit

Permalink
Collapse tuples of nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
devmotion authored Oct 23, 2023
1 parent 181c1be commit 2a887ee
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/adjoint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ for n = 0:3
gradtuple = Symbol(:gradtuple, n)
@eval begin
$gradtuple(x::Tuple) = ($(ntuple(_->:nothing,n)...), x...)
$gradtuple(::Tuple{Vararg{Nothing}}) = nothing
$gradtuple(x::Nothing) = nothing
$gradtuple(x) = error("Gradient $x should be a tuple")
end
Expand Down

0 comments on commit 2a887ee

Please sign in to comment.