From ae0a9faeca058a0c6a48e8718b0a4849e915c602 Mon Sep 17 00:00:00 2001 From: Lyndon White Date: Fri, 24 Sep 2021 15:26:16 +0100 Subject: [PATCH 1/2] NFC: test sum(iszero, xs) --- test/rulesets/Base/mapreduce.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/rulesets/Base/mapreduce.jl b/test/rulesets/Base/mapreduce.jl index c8d6e3260..90e2d0573 100644 --- a/test/rulesets/Base/mapreduce.jl +++ b/test/rulesets/Base/mapreduce.jl @@ -91,7 +91,9 @@ struct SumRuleConfig <: RuleConfig{Union{HasReverseMode}} end test_rrule(sum, sqrt, randn(5) .> 0) test_rrule(sum, sqrt, randn(5,5) .> 0; fkwargs=(;dims=1)) # ... and Bool produced by function - @test_skip test_rrule(sum, iszero, randn(5)) # DimensionMismatch("second dimension of A, 1, does not match length of x, 0") + # https://github.com/JuliaDiff/ChainRulesTestUtils.jl/issues/219 + -, pb = rrule(ADviaRuleConfig(), sum, iszero, randn(5))[2](2.0) + @test pb(1.0) == (NoTangent(), NoTangent(), NoTangent(),) end # https://github.com/JuliaDiff/ChainRules.jl/issues/522 From 2931e839c54f98d0f167be5aba9e7b107eaeab39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20M=C3=BCller-Widmann?= Date: Sun, 25 Oct 2026 23:00:59 +0100 Subject: [PATCH 2/2] Fix format Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- test/rulesets/Base/mapreduce.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/rulesets/Base/mapreduce.jl b/test/rulesets/Base/mapreduce.jl index 3854c65d1..6c18b0aa2 100644 --- a/test/rulesets/Base/mapreduce.jl +++ b/test/rulesets/Base/mapreduce.jl @@ -126,7 +126,7 @@ struct SumRuleConfig <: RuleConfig{Union{HasReverseMode}} end @test_skip test_rrule(sum, iszero, randn(5)) # DimensionMismatch("second dimension of A, 1, does not match length of x, 0") _, pb = rrule(CFG, sum, iszero, randn(5)) - @test pb(1.0) == (NoTangent(), NoTangent(), NoTangent(),) + @test pb(1.0) == (NoTangent(), NoTangent(), NoTangent()) # Functions that return a Vector # see https://github.com/FluxML/Zygote.jl/issues/1074