Skip to content

Commit 0105cf9

Browse files
committed
fix doctests
1 parent 5a52f13 commit 0105cf9

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

docs/src/index.md

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,11 @@ The call will test the `frule` for function `f` at the point `x` in the domain.
5656
Keep this in mind when testing discontinuous rules for functions like [ReLU](https://en.wikipedia.org/wiki/Rectifier_(neural_networks)), which should ideally be tested at both `x` being above and below zero.
5757

5858
```jldoctest ex; output = false
59-
using ChainRulesTestUtils
59+
julia> using ChainRulesTestUtils;
6060
61-
test_frule(two2three, 3.33, -7.77);
62-
63-
# output
64-
Test Summary: | Pass Total
65-
test_frule: two2three at (3.33, -7.77) | 5 5
66-
Test.DefaultTestSet("test_frule: two2three at (3.33, -7.77)", Any[Test.DefaultTestSet("Tuple{Float64,Float64,Float64}.1", Any[], 1, false), Test.DefaultTestSet("Tuple{Float64,Float64,Float64}.2", Any[], 1, false), Test.DefaultTestSet("Tuple{Float64,Float64,Float64}.3", Any[], 1, false)], 2, false)
61+
julia> test_frule(two2three, 3.33, -7.77);
62+
Test Summary: | Pass Total
63+
test_frule: two2three on Float64,Float64 | 5 5
6764
```
6865

6966
### Testing the `rrule`
@@ -72,12 +69,9 @@ Test.DefaultTestSet("test_frule: two2three at (3.33, -7.77)", Any[Test.DefaultTe
7269
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.
7370

7471
```jldoctest ex; output = false
75-
test_rrule(two2three, 3.33, -7.77);
76-
77-
# output
78-
Test Summary: | Pass Total
79-
test_rrule: two2three at (3.33, -7.77) | 6 6
80-
Test.DefaultTestSet("test_rrule: two2three at (3.33, -7.77)", Any[Test.DefaultTestSet("Don't thunk only non_zero argument", Any[], 0, false)], 6, false)
72+
julia> test_rrule(two2three, 3.33, -7.77);
73+
Test Summary: | Pass Total
74+
test_rrule: two2three on Float64,Float64 | 6 6
8175
```
8276

8377
## Scalar example
@@ -102,15 +96,13 @@ with the `frule` and `rrule` defined with the help of `@scalar_rule` macro
10296
`test_scalar` function is provided to test both the `frule` and the `rrule` with a single
10397
call.
10498
```jldoctest ex; output = false
105-
test_scalar(relu, 0.5);
106-
test_scalar(relu, -0.5);
107-
108-
# output
99+
julia> test_scalar(relu, 0.5);
109100
Test Summary: | Pass Total
110101
test_scalar: relu at 0.5 | 7 7
102+
103+
julia> test_scalar(relu, -0.5);
111104
Test Summary: | Pass Total
112105
test_scalar: relu at -0.5 | 7 7
113-
Test.DefaultTestSet("test_scalar: relu at -0.5", Any[Test.DefaultTestSet("with tangent 1.0", Any[Test.DefaultTestSet("test_frule: relu at (ChainRulesTestUtils.PrimalAndTangent{Float64,Float64}(-0.5, 1.0),)", Any[], 3, false)], 0, false), Test.DefaultTestSet("with cotangent 1.0", Any[Test.DefaultTestSet("test_rrule: relu at (ChainRulesTestUtils.PrimalAndTangent{Float64,Float64}(-0.5, 1.0),)", Any[Test.DefaultTestSet("Don't thunk only non_zero argument", Any[], 0, false)], 4, false)], 0, false)], 0, false)
114106
```
115107

116108
## Specifying Tangents

0 commit comments

Comments
 (0)