From e9a60757196368f8999e2413f2658a3d9cfffab4 Mon Sep 17 00:00:00 2001 From: Brian Chen Date: Fri, 24 Jun 2022 12:43:33 -0700 Subject: [PATCH] basic comment for Context{I} --- src/compiler/interface.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compiler/interface.jl b/src/compiler/interface.jl index f429102f6..ee2a69528 100644 --- a/src/compiler/interface.jl +++ b/src/compiler/interface.jl @@ -4,6 +4,9 @@ using Core: Typeof import Base: copy!, IdSet import Base.Broadcast: broadcasted, materialize! +# Internal container used to track accumulated gradients of mutable types (including params). +# Type param I ∈ (true, false) indicates whether implicit params are in use. +# By default, this should be false unless pullback(f, ::Params) is called. mutable struct Context{I} <: AContext cache::Union{IdDict{Any,Any},Nothing} end @@ -47,11 +50,11 @@ function pullback(cx::Context, f, args...) Incorrect argument order for pullback, please use: pullback(f, __context__::Context, args) - + instead of: pullback(__context__::Context, f, args) - + This is usually caused by a call to pullback in a higher-order @adjoint. The above warning will become an error in Zygote 0.7. """