Skip to content

Commit

Permalink
Merge pull request #26 from devmotion/patch-1
Browse files Browse the repository at this point in the history
Collapse tuples of `nothing`
  • Loading branch information
ToucheSir authored Jan 13, 2024
2 parents d8aba5f + 2a887ee commit acd86a9
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 acd86a9

Please sign in to comment.