Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 32 additions & 30 deletions test/ad/enzyme.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,43 +23,45 @@ using Test
# `@test_throws`. Consequently `@test_throws` doesn't actually see any error. Weird Julia
# behaviour.

@testset "Enzyme: Bijectors.find_alpha" begin
x = randn()
y = expm1(randn())
z = randn()
@static if VERSION < v"1.11"
@testset "Enzyme: Bijectors.find_alpha" begin
x = randn()
y = expm1(randn())
z = randn()

@testset "forward" begin
# No batches
@testset for RT in (Const, Duplicated, DuplicatedNoNeed),
Tx in (Const, Duplicated),
Ty in (Const, Duplicated),
Tz in (Const, Duplicated)
@testset "forward" begin
# No batches
@testset for RT in (Const, Duplicated, DuplicatedNoNeed),
Tx in (Const, Duplicated),
Ty in (Const, Duplicated),
Tz in (Const, Duplicated)

test_forward(Bijectors.find_alpha, RT, (x, Tx), (y, Ty), (z, Tz))
end
test_forward(Bijectors.find_alpha, RT, (x, Tx), (y, Ty), (z, Tz))
end

# Batches
@testset for RT in (Const, BatchDuplicated, BatchDuplicatedNoNeed),
Tx in (Const, BatchDuplicated),
Ty in (Const, BatchDuplicated),
Tz in (Const, BatchDuplicated)
# Batches
@testset for RT in (Const, BatchDuplicated, BatchDuplicatedNoNeed),
Tx in (Const, BatchDuplicated),
Ty in (Const, BatchDuplicated),
Tz in (Const, BatchDuplicated)

test_forward(Bijectors.find_alpha, RT, (x, Tx), (y, Ty), (z, Tz))
test_forward(Bijectors.find_alpha, RT, (x, Tx), (y, Ty), (z, Tz))
end
end
end
@testset "reverse" begin
# No batches
@testset for RT in (Const, Active),
Tx in (Const, Active),
Ty in (Const, Active),
Tz in (Const, Active)
@testset "reverse" begin
# No batches
@testset for RT in (Const, Active),
Tx in (Const, Active),
Ty in (Const, Active),
Tz in (Const, Active)

test_reverse(Bijectors.find_alpha, RT, (x, Tx), (y, Ty), (z, Tz))
end
test_reverse(Bijectors.find_alpha, RT, (x, Tx), (y, Ty), (z, Tz))
end

# TODO: Test batch mode
# This is a bit problematic since Enzyme does not support all combinations of activities currently
# https://github.com/TuringLang/Bijectors.jl/pull/350#issuecomment-2480468728
# TODO: Test batch mode
# This is a bit problematic since Enzyme does not support all combinations of activities currently
# https://github.com/TuringLang/Bijectors.jl/pull/350#issuecomment-2480468728
Copy link
Collaborator

Choose a reason for hiding this comment

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

btw this comment no longer applies and this is supported

end
end
end

Expand Down