You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and `rrule` which contains a mistake in the first cotangent
42
45
```jldoctest ex
43
46
function ChainRulesCore.rrule(::typeof(two2three), x1, x2)
44
47
y = two2three(x1, x2)
45
48
function two2three_pullback(Ȳ)
46
-
return (NoTangent(), 2.0*Ȳ[2], 3.0*Ȳ[3])
49
+
return (NoTangent(), 2.1*Ȳ[2], 3.0*Ȳ[3])
47
50
end
48
51
return y, two2three_pullback
49
52
end
@@ -65,23 +68,28 @@ Keep this in mind when testing discontinuous rules for functions like [ReLU](htt
65
68
julia> using ChainRulesTestUtils;
66
69
67
70
julia> test_frule(two2three, 3.33, -7.77);
68
-
Test Summary: | Pass Total
69
-
test_frule: two2three on Float64,Float64 | 6 6
71
+
Test Summary: | Pass Total Time
72
+
test_frule: two2three on Float64,Float64 | 6 6 2.7s
70
73
71
74
```
72
75
73
76
### Testing the `rrule`
74
77
75
-
[`test_rrule`](@ref) takes in the function `f`, and primal inputsr`x`.
78
+
[`test_rrule`](@ref) takes in the function `f`, and primal inputs`x`.
76
79
The call will test the `rrule` for function `f` at the point `x`, and similarly to `frule` some rules should be tested at multiple points in the domain.
77
80
78
81
```jldoctest ex
79
82
julia> test_rrule(two2three, 3.33, -7.77);
80
-
Test Summary: | Pass Total
81
-
test_rrule: two2three on Float64,Float64 | 9 9
82
-
83
+
test_rrule: two2three on Float64,Float64: Test Failed at /home/lior/.julia/dev/ChainRulesTestUtils/src/check_result.jl:24
The output of the test indicates to us the cause of the failure under "Problem:" with the expected (`rrule` derived) and actual finite difference results.
91
+
The Problem lies with the cotangent corresponding to input 2 of `rrule`, which is the first cotangent as expected.
92
+
85
93
## Scalar example
86
94
87
95
For functions with a single argument and a single output, such as e.g. ReLU,
@@ -105,13 +113,13 @@ with the `frule` and `rrule` defined with the help of `@scalar_rule` macro
0 commit comments