Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
GiggleLiu committed Apr 29, 2020
1 parent a5156bd commit 18f5062
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/src/extend.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@ julia> check_inv(ROT, (1.0, 2.0, 3.0))
true
```

For self-reversible functions, one can declare the reversibility for it like this
```julia
"""
SWAP(a!, b!) -> b!, a!
"""
@inline function SWAP(a!::Real, b!::Real)
b!, a!
end
@selfdual SWAP
```

To bind gradients for this multi-in, multi-out function.
The general approach is *Binding the backward rule on its inverse*!

Expand Down

0 comments on commit 18f5062

Please sign in to comment.