Skip to content

Commit

Permalink
Mark Sampling context as not needing derivatives
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Nov 8, 2023
1 parent 2e940aa commit c63e95e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LogDensityProblems = "6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
Expand All @@ -34,10 +35,11 @@ AbstractPPL = "0.6"
BangBang = "0.3"
Bijectors = "0.13"
ChainRulesCore = "0.9.7, 0.10, 1"
ConstructionBase = "1.5.4"
Compat = "4"
ConstructionBase = "1.5.4"
Distributions = "0.23.8, 0.24, 0.25"
DocStringExtensions = "0.8, 0.9"
EnzymeCore = "0.6"
LogDensityProblems = "2"
MCMCChains = "6"
MacroTools = "0.5.6"
Expand Down
3 changes: 3 additions & 0 deletions src/contexts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ struct SamplingContext{S<:AbstractSampler,C<:AbstractContext,R} <: AbstractConte
context::C
end

using EnzymeCore
@inline EnzymeCore.EnzymeRules.inactive_type(::Type{T}) where {T <: SamplingContext} = true

Check warning on line 141 in src/contexts.jl

View workflow job for this annotation

GitHub Actions / format

[JuliaFormatter] reported by reviewdog 🐶 Raw Output: src/contexts.jl:141:-@inline EnzymeCore.EnzymeRules.inactive_type(::Type{T}) where {T <: SamplingContext} = true src/contexts.jl:141:+@inline EnzymeCore.EnzymeRules.inactive_type(::Type{T}) where {T<:SamplingContext} = true

Check warning on line 141 in src/contexts.jl

View check run for this annotation

Codecov / codecov/patch

src/contexts.jl#L141

Added line #L141 was not covered by tests

function SamplingContext(
rng::Random.AbstractRNG=Random.default_rng(), sampler::AbstractSampler=SampleFromPrior()
)
Expand Down

0 comments on commit c63e95e

Please sign in to comment.