Skip to content

Commit

Permalink
fix: check was accidentally broken
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Sep 22, 2024
1 parent 10488cd commit 9c716b5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name = "LuxTestUtils"
uuid = "ac9de150-d08f-4546-94fb-7472b5760531"
authors = ["Avik Pal <[email protected]>"]
version = "1.3.0"
version = "1.3.1"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
DispatchDoctor = "8d63f2c5-f18a-4cf2-ba9d-b3f60fc568c8"
Expand All @@ -21,6 +22,7 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[compat]
ADTypes = "1.8.1"
ArrayInterface = "7.9"
ChainRulesCore = "1.24.0"
ComponentArrays = "0.15.14"
DispatchDoctor = "0.4.12"
Expand Down
1 change: 1 addition & 0 deletions src/LuxTestUtils.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module LuxTestUtils

using ArrayInterface: ArrayInterface
using ComponentArrays: ComponentArray, getdata, getaxes
using DispatchDoctor: allow_unstable
using Functors: Functors
Expand Down
6 changes: 3 additions & 3 deletions src/autodiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ function test_gradients(f, args...; skip_backends=[], broken_backends=[],
@testset "$(nameof(typeof(backends[1])))() vs $(nameof(typeof(backend)))()" for backend in backends[2:end]
local_test_expr = :([$(nameof(typeof(backend)))] - $(test_expr))

result = if backend in skip_backends
result = if check_ad_backend_in(backend, skip_backends)
Broken(:skipped, local_test_expr)
elseif (soft_fail isa Bool && soft_fail) ||
(soft_fail isa Vector && backend in soft_fail)
(soft_fail isa Vector && check_ad_backend_in(backend, soft_fail))
try
∂args = allow_unstable() do
return gradient(f, backend, args...)
Expand All @@ -189,7 +189,7 @@ function test_gradients(f, args...; skip_backends=[], broken_backends=[],
catch
Broken(:test, local_test_expr)
end
elseif backend in broken_backends
elseif check_ad_backend_in(backend, broken_backends)
try
∂args = allow_unstable() do
return gradient(f, backend, args...)
Expand Down
6 changes: 6 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,9 @@ function reorder_macro_kw_params(exs)
end
return Tuple(exs)
end

function check_ad_backend_in(backend, backends)
backends_type = map(ArrayInterface.parameterless_type typeof, backends)
backend_type = ArrayInterface.parameterless_type(typeof(backend))
return backend_type in backends_type
end

2 comments on commit 9c716b5

@avik-pal
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/115681

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.3.1 -m "<description of version>" 9c716b59d1ab4e716a864c8b53eeb6965beed71d
git push origin v1.3.1

Please sign in to comment.