@@ -38,7 +38,8 @@ Configuration type to dispatch on in custom forward rules (see [`forward`](@ref)
3838* `RuntimeActivity`: whether runtime activity is enabled. See the [FAQ](@ref faq-runtime-activity) for more information.
3939* `StrongZero`: whether strong zero is enabled. See the [FAQ](@ref faq-strong-zero) for more information.
4040
41- Getters for the type parameters are provided by `needs_primal`, `needs_shadow`, `width` `runtime_activity`, and `strong_zero`.
41+ Getters for the type parameters are provided by [`needs_primal`](@ref), [`needs_shadow`](@ref),
42+ [`width`](@ref), `runtime_activity`, and `strong_zero`.
4243"""
4344struct FwdConfig{NeedsPrimal, NeedsShadow, Width, RuntimeActivity, StrongZero} end
4445const FwdConfigWidth{Width} = FwdConfig{<: Any ,<: Any ,Width}
@@ -72,7 +73,7 @@ Whether a custom rule should return the shadow (derivative) of the function resu
7273 width(::Type{<:FwdConfig})
7374 width(::Type{<:RevConfig})
7475
75- Get the size of a batch
76+ Get the size of a batch.
7677"""
7778@inline width (:: FwdConfig{<:Any, <:Any, Width} ) where Width = Width
7879@inline width (:: Type{<:FwdConfig{<:Any, <:Any, Width}} ) where Width = Width
@@ -89,11 +90,12 @@ Configuration type to dispatch on in custom reverse rules (see [`augmented_prima
8990* `NeedsPrimal` and `NeedsShadow`: boolean values specifying whether the primal and shadow (resp.) should be returned.
9091* `Width`: an integer that specifies the number of adjoints/shadows simultaneously being propagated.
9192* `Overwritten`: a tuple of booleans of whether each argument (including the function itself) is modified between the
92- forward and reverse pass (true if potentially modified between).
93+ forward and reverse pass (` true` if potentially modified between).
9394* `RuntimeActivity`: whether runtime activity is enabled. See the [FAQ](@ref faq-runtime-activity) for more information.
9495* `StrongZero`: whether strong zero is enabled. See the [FAQ](@ref faq-strong-zero) for more information.
9596
96- Getters for the type parameters are provided by `needs_primal`, `needs_shadow`, `width`, `overwritten`, `runtime_activity`, and `strong_zero`.
97+ Getters for the type parameters are provided by [`needs_primal`](@ref), [`needs_shadow`](@ref), [`width`](@ref),
98+ [`overwritten`](@ref), `runtime_activity`, and `strong_zero`.
9799"""
98100struct RevConfig{NeedsPrimal, NeedsShadow, Width, Overwritten, RuntimeActivity, StrongZero} end
99101const RevConfigWidth{Width} = RevConfig{<: Any ,<: Any , Width}
@@ -123,7 +125,7 @@ between).
123125 primal_type(::FwdConfig, ::Type{<:Annotation{RT}})
124126 primal_type(::RevConfig, ::Type{<:Annotation{RT}})
125127
126- Compute the exepcted primal return type given a reverse mode config and return activity
128+ Compute the expected primal return type given a reverse mode config and return activity
127129"""
128130@inline primal_type (config:: FwdConfig , :: Type{<:Annotation{RT}} ) where RT = needs_primal (config) ? RT : Nothing
129131@inline primal_type (config:: RevConfig , :: Type{<:Annotation{RT}} ) where RT = needs_primal (config) ? RT : Nothing
@@ -132,7 +134,7 @@ Compute the exepcted primal return type given a reverse mode config and return a
132134 shadow_type(::FwdConfig, ::Type{<:Annotation{RT}})
133135 shadow_type(::RevConfig, ::Type{<:Annotation{RT}})
134136
135- Compute the exepcted shadow return type given a reverse mode config and return activity
137+ Compute the expected shadow return type given a reverse mode config and return activity
136138"""
137139@inline shadow_type (config:: FwdConfig , :: Type{<:Annotation{RT}} ) where RT = needs_shadow (config) ? (width (config) == 1 ? RT : NTuple{width (config), RT}) : Nothing
138140@inline shadow_type (config:: RevConfig , :: Type{<:Annotation{RT}} ) where RT = needs_shadow (config) ? (width (config) == 1 ? RT : NTuple{width (config), RT}) : Nothing
@@ -175,19 +177,22 @@ end
175177 augmented_primal(::RevConfig, func::Annotation{typeof(f)}, RT::Type{<:Annotation}, args::Annotation...)
176178
177179Must return an [`AugmentedReturn`](@ref) type.
178- * The primal must be the same type of the original return if `needs_primal(config)`, otherwise nothing.
179- * The shadow must be nothing if needs_shadow(config) is false. If width is 1, the shadow should be the same
180- type of the original return. If the width is greater than 1, the shadow should be NTuple{original return, width}.
181- * The tape can be any type (including Nothing) and is preserved for the reverse call.
180+ * The primal must be the same type of the original return if [`needs_primal(config)`](@ref needs_primal),
181+ otherwise nothing.
182+ * The shadow must be nothing if [`needs_shadow(config)`](@ref needs_shadow) is `false`.
183+ If width is 1, the shadow should be the same type of the original return.
184+ If the width is greater than 1, the shadow should be `NTuple{original return, width}`.
185+ * The tape can be any type (including `Nothing`), and is preserved for the reverse call.
182186"""
183187function augmented_primal end
184188
185189"""
186190 reverse(::RevConfig, func::Annotation{typeof(f)}, dret::Active, tape, args::Annotation...)
187191 reverse(::RevConfig, func::Annotation{typeof(f)}, ::Type{<:Annotation), tape, args::Annotation...)
188192
189- Takes gradient of derivative, activity annotation, and tape. If there is an active return dret is passed
190- as Active{T} with the derivative of the active return val. Otherwise dret is passed as Type{Duplicated{T}}, etc.
193+ Takes gradient of derivative, activity annotation, and tape. If there is an active return, `dret` is passed
194+ as `Active{T}` with the derivative of the active return value. Otherwise, `dret` is passed
195+ as `Type{Duplicated{T}}`, etc.
191196"""
192197function reverse end
193198
0 commit comments