Skip to content

Commit dac0557

Browse files
mcabbottoxinabox
andcommitted
Apply suggestions from code review
Co-authored-by: Lyndon White <oxinabox@ucc.asn.au>
1 parent 409c8d0 commit dac0557

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/projection.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,7 @@ function (project::ProjectTo{AbstractArray})(dx::AbstractArray{S,M}) where {S,M}
223223
end
224224

225225
# Trivial case -- won't collapse Any[NoTangent(), NoTangent()]
226-
function (project::ProjectTo{AbstractArray})(dx::AbstractArray{<:AbstractZero})
227-
return NoTangent()
228-
end
226+
(project::ProjectTo{AbstractArray})(dx::AbstractArray{<:AbstractZero}) = NoTangent()
229227

230228
# Row vectors aren't acceptable as gradients for 1-row matrices:
231229
function (project::ProjectTo{AbstractArray})(dx::LinearAlgebra.AdjOrTransAbsVec)

test/projection.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ Base.zero(x::Dual) = Dual(zero(x.value), zero(x.partial))
7171
@test prow(adjoint([1, 2, 3])) isa Matrix
7272

7373
# some bugs
74-
@test pvec3(fill(NoTangent(), 3)) === NoTangent() #410, was an array of such
75-
@test ProjectTo([pi])([1]) isa Vector{Int} #423, was Irrational -> Bool -> NoTangent
74+
@test pvec3(fill(NoTangent(), 3)) === NoTangent() #410, was an array of such
75+
@test ProjectTo([pi])([1]) isa Vector{Int} #423, was Irrational -> Bool -> NoTangent
7676
end
7777

7878
@testset "Base: arrays of arrays, etc" begin

0 commit comments

Comments
 (0)