@@ -253,33 +253,33 @@ Base.conj(x::AbstractThunk) = @thunk(conj(extern(x)))
253
253
Base. show (io:: IO , x:: Thunk ) = println (io, " Thunk($(repr (x. f)) )" )
254
254
255
255
"""
256
- InplaceThunk (val::Thunk, add!::Function)
256
+ InplaceableThunk (val::Thunk, add!::Function)
257
257
258
258
A wrapper for a `Thunk`, that allows it to define an inplace `add!` function,
259
- which is used internally in `accumulate!(Δ, ::InplaceThunk )`.
259
+ which is used internally in `accumulate!(Δ, ::InplaceableThunk )`.
260
260
261
261
`add!` should be defined such that: `ithunk.add!(Δ) = Δ .+= ithunk.val`
262
262
but it should do this more efficently than simply doing this directly.
263
263
(Otherwise one can just use a normal `Thunk`).
264
264
265
- Most operations on an `InplaceThunk ` treat it just like a normal `Thunk`;
265
+ Most operations on an `InplaceableThunk ` treat it just like a normal `Thunk`;
266
266
and destroy its inplacability.
267
267
"""
268
- struct InplaceThunk {T<: Thunk , F} <: AbstractThunk
268
+ struct InplaceableThunk {T<: Thunk , F} <: AbstractThunk
269
269
val:: T
270
270
add!:: F
271
271
end
272
272
273
- (x:: InplaceThunk )() = x. val ()
274
- @inline extern (x:: InplaceThunk ) = extern (x. val)
273
+ (x:: InplaceableThunk )() = x. val ()
274
+ @inline extern (x:: InplaceableThunk ) = extern (x. val)
275
275
276
- function Base. show (io:: IO , x:: InplaceThunk )
277
- println (io, " InplaceThunk ($(repr (x. val)) , $(repr (x. add!)) )" )
276
+ function Base. show (io:: IO , x:: InplaceableThunk )
277
+ println (io, " InplaceableThunk ($(repr (x. val)) , $(repr (x. add!)) )" )
278
278
end
279
279
280
280
# The real reason we have this:
281
- accumulate! (Δ, ∂:: InplaceThunk ) = ∂. add! (Δ)
282
- store! (Δ, ∂:: InplaceThunk ) = ∂. add! ((Δ.*= false )) # zero it, then add to it.
281
+ accumulate! (Δ, ∂:: InplaceableThunk ) = ∂. add! (Δ)
282
+ store! (Δ, ∂:: InplaceableThunk ) = ∂. add! ((Δ.*= false )) # zero it, then add to it.
283
283
284
284
"""
285
285
NO_FIELDS
0 commit comments