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 19, 2023
1 parent c9489aa commit a1d1b35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions 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 @@ -38,6 +39,7 @@ Compat = "4"
ConstructionBase = "1.5.4"
Distributions = "0.25"
DocStringExtensions = "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

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

0 comments on commit a1d1b35

Please sign in to comment.