Skip to content

Commit 765ecfc

Browse files
committed
rename InplaceableThunk InplaceThunk
1 parent 752732e commit 765ecfc

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/ChainRulesCore.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export frule, rrule
55
export wirtinger_conjugate, wirtinger_primal, differential
66
export @scalar_rule, @thunk
77
export extern, cast, store!
8-
export Wirtinger, Zero, One, Casted, DNE, Thunk, InplaceableThunk
8+
export Wirtinger, Zero, One, Casted, DNE, Thunk, InplaceThunk
99
export NO_FIELDS
1010

1111
include("differentials.jl")

src/differentials.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -254,33 +254,33 @@ Base.conj(x::AbstractThunk) = @thunk(conj(extern(x)))
254254
Base.show(io::IO, x::Thunk) = println(io, "Thunk($(repr(x.f)))")
255255

256256
"""
257-
InplaceableThunk(val::Thunk, add!::Function)
257+
InplaceThunk(val::Thunk, add!::Function)
258258
259259
A wrapper for a `Thunk`, that allows it to define an inplace `add!` function,
260-
which is used internally in `accumulate!(Δ, ::InplaceableThunk)`.
260+
which is used internally in `accumulate!(Δ, ::InplaceThunk)`.
261261
262262
`add!` should be defined such that: `ithunk.add!(Δ) = Δ .+= ithunk.val`
263263
but it should do this more efficently than simply doing this directly.
264264
(Otherwise one can just use a normal `Thunk`).
265265
266-
Most operations on an `InplaceableThunk` treat it just like a normal `Thunk`;
266+
Most operations on an `InplaceThunk` treat it just like a normal `Thunk`;
267267
and destroy its inplacability.
268268
"""
269-
struct InplaceableThunk{T<:Thunk, F} <: AbstractThunk
269+
struct InplaceThunk{T<:Thunk, F} <: AbstractThunk
270270
val::T
271271
add!::F
272272
end
273273

274-
(x::InplaceableThunk)() = x.val()
275-
@inline extern(x::InplaceableThunk) = extern(x.val)
274+
(x::InplaceThunk)() = x.val()
275+
@inline extern(x::InplaceThunk) = extern(x.val)
276276

277-
function Base.show(io::IO, x::InplaceableThunk)
278-
println(io, "InplaceableThunk($(repr(x.val)), $(repr(x.add!)))")
277+
function Base.show(io::IO, x::InplaceThunk)
278+
println(io, "InplaceThunk($(repr(x.val)), $(repr(x.add!)))")
279279
end
280280

281281
# The real reason we have this:
282-
accumulate!(Δ, ∂::InplaceableThunk) =.add!(Δ)
283-
store!(Δ, ∂::InplaceableThunk) =.add!((Δ.*=false)) # zero it, then add to it.
282+
accumulate!(Δ, ∂::InplaceThunk) =.add!(Δ)
283+
store!(Δ, ∂::InplaceThunk) =.add!((Δ.*=false)) # zero it, then add to it.
284284

285285
"""
286286
NO_FIELDS

0 commit comments

Comments
 (0)