Skip to content

Commit

Permalink
fix some ComponentArray grads reverting to Vector
Browse files Browse the repository at this point in the history
  • Loading branch information
marius311 committed Apr 26, 2021
1 parent 6d18650 commit 43316b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/autodiff.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

# this does basis promotion, unlike Zygote's default for AbstractArrays
Zygote.accum(a::Field, b::Field) = a+b
Zygote.accum(a::FieldTuple, b::FieldTuple) = Zygote.accum.(a,b)
# this may create a LazyBinaryOp, unlike Zygote's
Zygote.accum(a::FieldOp, b::FieldOp) = a+b

Expand Down
6 changes: 3 additions & 3 deletions src/dataset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ function load_sim(;
@warn "`rfid` will be removed in a future version. Use `fiducial_θ=(r=...,)` instead."
fiducial_θ = merge(fiducial_θ,(r=rfid,))
end
Aϕ₀ = get(fiducial_θ, :Aϕ, 1)
Aϕ₀ = T(get(fiducial_θ, :Aϕ, 1))
fiducial_θ = Base.structdiff(fiducial_θ, NamedTuple{(:Aϕ,)}) # remove Aϕ key if present
if (Cℓ == nothing)
Cℓ = camb(;fiducial_θ..., ℓmax=ℓmax)
Expand All @@ -241,7 +241,7 @@ function load_sim(;
error("ℓmax of `Cℓ` argument should be higher than $ℓmax for this configuration.")
end
end
r₀ = Cℓ.params.r
r₀ = T(Cℓ.params.r)

# noise Cℓs (these are non-debeamed, hence beamFWHM=0 below; the beam comes in via the B operator)
if (Cℓn == nothing)
Expand All @@ -264,7 +264,7 @@ function load_sim(;
Cf̃ = Cℓ_to_Cov(pol, proj, (Cℓ.total[k] for k in ks)...)
Cn̂ = Cℓ_to_Cov(pol, proj, (Cℓn[k] for k in ks)...)
if (Cn == nothing); Cn = Cn̂; end
Cf = ParamDependentOp((;r=r₀, _...)->(Cfs + T(r/r₀)*Cft))
Cf = ParamDependentOp((;r=r₀, _...)->(Cfs + (T(r)/r₀)*Cft))
= ParamDependentOp((;Aϕ=Aϕ₀, _...)->(T(Aϕ) * Cϕ₀))

# data mask
Expand Down

2 comments on commit 43316b9

@marius311
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: "Tag with name v0.6.0 already exists and points to a different commit"

Please sign in to comment.