Skip to content

Commit 09c133b

Browse files
authored
Mention that sometimes you should infact use 0 rather than zerotangent (#438)
1 parent 3c2200c commit 09c133b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

docs/src/writing_good_rules.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ The `ZeroTangent()` object exists as an alternative to directly returning `0` or
3434
It allows more optimal computation when chaining pullbacks/pushforwards, to avoid work.
3535
They should be used where possible.
3636

37+
However, sometimes for performance reasons this is not ideal.
38+
Especially, if it is to replace a scalar, and is in a type-unstable way.
39+
It causes problems if mapping over such pullbacks/pushforwards.
40+
This woull be solved once [JuliaLang/julia#38241](https://github.com/JuliaLang/julia/issues/38241) has been addressed.
41+
3742
## Use `Thunk`s appropriately
3843

3944
If work is only required for one of the returned differentials, then it should be wrapped in a `@thunk` (potentially using a `begin`-`end` block).

0 commit comments

Comments
 (0)