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 a1d1b35 commit 190d5c2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/contexts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ using DynamicPPL:
hasconditioned_nested,
getconditioned_nested

using EnzymeCore

# Dummy context to test nested behaviors.
struct ParentContext{C<:AbstractContext} <: AbstractContext
context::C
Expand Down Expand Up @@ -75,6 +77,13 @@ end
contexts = vcat(child_contexts, parent_contexts)

@testset "NodeTrait" begin
@testset "$context" for context in contexts
# Every `context` type should not be differentiated.
@test EnzymeCore.EnzymeRules.inactive_type(typeof(context))
end
end

@testset "Enzyme" begin
@testset "$context" for context in contexts
# Every `context` should have a `NodeTrait`.
@test NodeTrait(context) isa NodeTrait
Expand Down
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ include("test_util.jl")
if GROUP == "All" || GROUP == "DynamicPPL"
@testset "interface" begin
include("utils.jl")
include("enzyme.jl")
include("compiler.jl")
include("varinfo.jl")
include("simple_varinfo.jl")
Expand Down

0 comments on commit 190d5c2

Please sign in to comment.