FluxTraining.stateaccess
function
defined in module
FluxTraining
stateaccess(::Type{HyperParameter})
Defines what
Learner
state is accessed when calling
sethyperparameter!
and
gethyperparameter
. This is needed
so that
Scheduler
can access the state.
stateaccess(callback)
Return a named tuple determining what learner state
callback
can access. The default is
(;)
, the empty named tuple, meaning
no state can be accessed. Implementations of
stateaccess
should
always return the least permissions possible.
For example, the
ToGPU
callback needs to write both the model and
the batch data, so its
stateaccess
implementation is:
stateaccess
(
::
ToGPU
)
=
(
model
=
Write
(
)
,
params
=
Write
(
)
,
step
=
(
xs
=
Write
(
)
,
ys
=
Write
(
)
)
,
)
When defining
stateaccess
, be careful that you do return a
NamedTuple
.
(x = Read(),)
is one but
(x = Read())
(without the comma) is parsed as
an assignment with value
Read()
.
There are
19
methods for stateaccess
:
stateaccess(::FluxTraining.SafeCallback)
stateaccess(::MetricsPrinter)
stateaccess(::StopOnNaNLoss)
stateaccess(::ProgressPrinter)
stateaccess(::ToDevice)
stateaccess(cc::ConditionalCallback)
stateaccess(cc::CustomCallback)
stateaccess(::EarlyStopping)
stateaccess(::Type{LearningRate})
stateaccess(::Type{FluxTraining.HyperParameter})
stateaccess(::Checkpointer)
stateaccess(::LogVisualization)
stateaccess(::LogHistograms)
stateaccess(::LogHyperParams)
stateaccess(::LogMetrics)
stateaccess(::Metrics)
stateaccess(::Recorder)
stateaccess(::SanityCheck)
stateaccess(scheduler::Scheduler)
The following pages link back here:
Callback reference, Custom callbacks, How to use callbacks, Hyperparameter scheduling
callbacks/callback.jl , callbacks/callbacks.jl , callbacks/conditional.jl , callbacks/custom.jl , callbacks/earlystopping.jl , callbacks/graph.jl , callbacks/hyperparameters.jl , callbacks/logging/checkpointer.jl , callbacks/logging/logger.jl , callbacks/metrics.jl , callbacks/recorder.jl , callbacks/sanitycheck.jl , callbacks/scheduler.jl