From 5e76fa0ff0c7481116600f8d04a0a62fca9f58be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20S=C3=A1nchez=20Ram=C3=ADrez?= Date: Sat, 28 Dec 2024 23:38:57 +0100 Subject: [PATCH 1/4] test YaoBlocks --- test/Project.toml | 1 + test/integration/yao.jl | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 test/integration/yao.jl diff --git a/test/Project.toml b/test/Project.toml index 90b315b86..edde91deb 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -27,6 +27,7 @@ StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +YaoBlocks = "418bc28f-b43b-5e0b-a6e7-61bbc1a2c1df" [compat] Adapt = "4.1" diff --git a/test/integration/yao.jl b/test/integration/yao.jl new file mode 100644 index 000000000..cf9d27ff3 --- /dev/null +++ b/test/integration/yao.jl @@ -0,0 +1,11 @@ +using YaoBlocks, Reactant + +@testset "YaoBlocks" begin + f(θ) = mat(Rx(θ)) + + x = ConcreteRNumber(0.0) + @test @jit(f(x)) ≈ f(0.0) + + x = ConcreteRNumber(1.0) + @test @jit(f(x)) ≈ f(1.0) +end From 1c8b1294d1529f6a0a3829c849c1b5a88af4eb08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20S=C3=A1nchez=20Ram=C3=ADrez?= Date: Sat, 28 Dec 2024 23:40:37 +0100 Subject: [PATCH 2/4] run testset --- test/runtests.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/test/runtests.jl b/test/runtests.jl index 2b3238d10..81f2f5ed8 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -63,6 +63,7 @@ const REACTANT_TEST_GROUP = lowercase(get(ENV, "REACTANT_TEST_GROUP", "all")) @safetestset "AbstractFFTs" include("integration/fft.jl") @safetestset "Random" include("integration/random.jl") @safetestset "Python" include("integration/python.jl") + @safetestset "YaoBlocks" include("integration/yao.jl") end if REACTANT_TEST_GROUP == "all" || REACTANT_TEST_GROUP == "neural_networks" From eef365907676ea825caddc4ed2a27c5e3f2c43c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20S=C3=A1nchez=20Ram=C3=ADrez?= Date: Sun, 29 Dec 2024 02:08:43 +0100 Subject: [PATCH 3/4] skip test on macOS x64 --- test/integration/yao.jl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/integration/yao.jl b/test/integration/yao.jl index cf9d27ff3..0294c360c 100644 --- a/test/integration/yao.jl +++ b/test/integration/yao.jl @@ -1,11 +1,13 @@ using YaoBlocks, Reactant @testset "YaoBlocks" begin - f(θ) = mat(Rx(θ)) + if !(Sys.isapple() && Sys.ARCH === :x86_64) + f(θ) = mat(Rx(θ)) - x = ConcreteRNumber(0.0) - @test @jit(f(x)) ≈ f(0.0) + x = ConcreteRNumber(0.0) + @test @jit(f(x)) ≈ f(0.0) - x = ConcreteRNumber(1.0) - @test @jit(f(x)) ≈ f(1.0) + x = ConcreteRNumber(1.0) + @test @jit(f(x)) ≈ f(1.0) + end end From d54bf26f8a3484c466a2ccff51d258092b27dcba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20S=C3=A1nchez=20Ram=C3=ADrez?= <15837247+mofeing@users.noreply.github.com> Date: Sun, 29 Dec 2024 14:53:41 +0100 Subject: [PATCH 4/4] Revert last commit --- test/integration/yao.jl | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/test/integration/yao.jl b/test/integration/yao.jl index 0294c360c..cf9d27ff3 100644 --- a/test/integration/yao.jl +++ b/test/integration/yao.jl @@ -1,13 +1,11 @@ using YaoBlocks, Reactant @testset "YaoBlocks" begin - if !(Sys.isapple() && Sys.ARCH === :x86_64) - f(θ) = mat(Rx(θ)) + f(θ) = mat(Rx(θ)) - x = ConcreteRNumber(0.0) - @test @jit(f(x)) ≈ f(0.0) + x = ConcreteRNumber(0.0) + @test @jit(f(x)) ≈ f(0.0) - x = ConcreteRNumber(1.0) - @test @jit(f(x)) ≈ f(1.0) - end + x = ConcreteRNumber(1.0) + @test @jit(f(x)) ≈ f(1.0) end