Skip to content

Commit be04497

Browse files
committed
Update docstests to cover frule returning composite
1 parent 42b50ba commit be04497

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/rules.jl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,30 @@ julia> Δsinx == cos(x)
2929
true
3030
```
3131
32-
unary input, binary output scalar function:
32+
Unary input, binary output scalar function:
3333
3434
```jldoctest frule
3535
julia> sincosx, Δsincosx = frule((dself, 1), sincos, x);
3636
3737
julia> sincosx == sincos(x)
3838
true
3939
40-
julia> Δsincosx == (cos(x), -sin(x))
40+
julia> Δsincosx[1] == cos(x)
41+
true
42+
43+
julia> Δsincosx[2] == -sin(x)
4144
true
4245
```
4346
47+
Note that techically speaking julia does not have multiple output functions, just functions
48+
that return a single output that is iterable, like a `Tuple`.
49+
So this is actually a [`Composite`](@ref):
50+
```jldoctest frule
51+
julia> Δsincosx
52+
Composite{Tuple{Float64,Float64}}(0.6795498147167869, -0.7336293678134624)
53+
```.
54+
55+
4456
See also: [`rrule`](@ref), [`@scalar_rule`](@ref)
4557
"""
4658
frule(::Any, ::Vararg{Any}; kwargs...) = nothing

0 commit comments

Comments
 (0)