Skip to content

Commit 57813a2

Browse files
committed
Mention constructors
1 parent 73e3a2a commit 57813a2

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

docs/src/converting_zygoterules.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ end
3838
No magic macro here, `rrule` is the function that it is.
3939
The function it is the rule for is the first argument, or second argument if you need to take a `[RuleConfig`](@ref).
4040

41+
Note that when writing the rule for constructor you will need to use `::Type{Foo}`, not `typeof(Foo)`.
42+
See docs on [Constructors](@ref).
43+
4144
## Include the derivative with respect to the function object itself
4245
The `ZygoteRules.@adjoint` macro automagically[^1] inserts a extra `nothing` in the return for the function it generates to represent the derivative of output with respect to the function object.
4346
ChainRules as a philosophy avoids magic as much as possible, and thus require you to return it explicitly.

0 commit comments

Comments
 (0)