Skip to content

Commit dd8f52a

Browse files
committed
add removed adjoint for Base.adjoint
FluxML/Zygote.jl#1259
1 parent f3dd2e0 commit dd8f52a

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/autodiff.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,14 @@ end
135135
# putting stuff in the correct basis, although they're working for everything
136136
# I've needed thus far
137137

138+
@adjoint adjoint(x::FieldOrOpArray) = x', Δ ->',)
139+
138140
@adjoint function *(x::FieldOrOpRowVector, y::FieldVector)
139141
z = x * y
140142
# when x is a vector of Fields
141143
back::Real) = ((Δ * y)', x' * Δ)
142-
# when x is a vector of Diagonals. in this case, Δ * basis(Δ)(y)'
143-
back::Field{B}) where {B} =* basis(Δ)(y)'), (x' * Δ)
144+
# when x is a vector of Diagonals.
145+
back::Field{B}) where {B} =* B(y)'), (x' * Δ)
144146
z, back
145147
end
146148

test/runtests.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11

2+
using CMBLensing
3+
using CMBLensing: @SMatrix, @SVector, AbstractCℓs, basis, Basis,
4+
LinearInterpolation, Measurement, RK4Solver, ±, typealias, BatchedReal
5+
6+
##
7+
28
using CUDA
39
if !haskey(ENV, "JULIA_CMBLENSING_TEST_CPU") && CUDA.functional()
410
CUDA.allowscalar(false)
@@ -13,12 +19,6 @@ end
1319

1420
##
1521

16-
using CMBLensing
17-
using CMBLensing: @SMatrix, @SVector, AbstractCℓs, basis, Basis,
18-
LinearInterpolation, Measurement, RK4Solver, ±, typealias, BatchedReal
19-
20-
##
21-
2222
using Adapt
2323
using FileIO
2424
using FFTW

0 commit comments

Comments
 (0)