Skip to content

Commit e9a6075

Browse files
committed
basic comment for Context{I}
1 parent be5b47f commit e9a6075

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/compiler/interface.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ using Core: Typeof
44
import Base: copy!, IdSet
55
import Base.Broadcast: broadcasted, materialize!
66

7+
# Internal container used to track accumulated gradients of mutable types (including params).
8+
# Type param I ∈ (true, false) indicates whether implicit params are in use.
9+
# By default, this should be false unless pullback(f, ::Params) is called.
710
mutable struct Context{I} <: AContext
811
cache::Union{IdDict{Any,Any},Nothing}
912
end
@@ -47,11 +50,11 @@ function pullback(cx::Context, f, args...)
4750
Incorrect argument order for pullback, please use:
4851
4952
pullback(f, __context__::Context, args)
50-
53+
5154
instead of:
5255
5356
pullback(__context__::Context, f, args)
54-
57+
5558
This is usually caused by a call to pullback in a higher-order @adjoint.
5659
The above warning will become an error in Zygote 0.7.
5760
"""

0 commit comments

Comments
 (0)