CustomCallback
struct
defined in module
FluxTraining
CustomCallback(f, Event, [TPhase = Phase, access = (;)])
A callback that runs
f(learner)
every time an event of type
Event
during a phase of type in
Phase
.
If
f
needs to access learner state, pass
access
, a named tuple
in the same form as
stateaccess
.
Instead of using
CustomCallback
it is recommended to properly
implement a
Callback
.
We can get a quick idea of when a new epoch starts as follows:
cb
=
CustomCallback
(
learner
->
println
(
"
New epoch!
"
)
,
EpochBegin
)
There are
3
methods for CustomCallback
:
CustomCallback(f, E::Type{<:FluxTraining.Events.Event})
CustomCallback(f, E::Type{<:FluxTraining.Events.Event}, P::Type{<:FluxTraining.Phases.Phase})
CustomCallback(f, E::Type{<:FluxTraining.Events.Event}, P::Type{<:FluxTraining.Phases.Phase}, access)
The following pages link back here:
FluxTraining.jl , callbacks/callbacks.jl , callbacks/custom.jl