Skip to content

Commit

Permalink
Merge pull request #45 from axelparmentier/jet
Browse files Browse the repository at this point in the history
Add static tests with JET
  • Loading branch information
gdalle authored Apr 21, 2023
2 parents 7e65548 + f057e5a commit b1d164c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
version:
- '1.7'
- '1.8'
- '~1.9.0-0'
os:
- ubuntu-latest
arch:
Expand Down
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
FrankWolfe = "f55ce6ea-fdc5-4628-88c5-0087fe54bd30"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
GridGraphs = "dd2b58c7-5af7-4f17-9e46-57c68ac813fb"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
Expand All @@ -46,4 +48,4 @@ UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[targets]
test = ["Aqua", "Documenter", "Flux", "FrankWolfe", "Graphs", "GridGraphs", "JuliaFormatter", "LinearAlgebra", "Literate", "ProgressMeter", "Random", "Revise", "Statistics", "Test", "UnicodePlots", "Zygote"]
test = ["Aqua", "Documenter", "Flux", "FrankWolfe", "Graphs", "GridGraphs", "JET", "JuliaFormatter", "LinearAlgebra", "Literate", "Pkg", "ProgressMeter", "Random", "Revise", "Statistics", "Test", "UnicodePlots", "Zygote"]
2 changes: 1 addition & 1 deletion src/imitation_loss/imitation_loss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ end
Retrieve `y_true` from `t_true`.
This method should be implemented when using a custom data structure for `t_true` other than a `NamedTuple`.
"""
get_y_true(t_true) = error("not implemented")
function get_y_true end

"""
get_y_true(t_true::NamedTuple)
Expand Down
4 changes: 1 addition & 3 deletions src/ssvm/isbaseloss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,4 @@ For `δ::L` to comply with this interface, the following methods must exist:
Compute `argmax_y {δ(y, y_true) + α θᵀ(y - y_true)}` to deduce the gradient of a `StructuredSVMLoss`.
"""
@traitfn function compute_maximizer::L, θ, α, y_true; kwargs...) where {L; IsBaseLoss{L}}
return error("not implemented")
end
function compute_maximizer end
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using Revise
using Aqua
using InferOpt
using JET
using JuliaFormatter
using Pkg
using Test
using Zygote

includet("utils/dataset.jl")
includet("utils/error.jl")
Expand All @@ -16,6 +19,11 @@ includet("utils/pipeline.jl")
@testset verbose = true "Code formatting (JuliaFormatter.jl)" begin
@test format(InferOpt; verbose=false, overwrite=false)
end
@testset verbose = true "Code correctness (JET.jl)" begin
if VERSION >= v"1.8"
JET.test_package(InferOpt; toplevel_logger=nothing, mode=:typo)
end
end
@testset verbose = true "Jacobian approx" begin
include("jacobian_approx.jl")
end
Expand Down

0 comments on commit b1d164c

Please sign in to comment.