.FluxTrainingstateaccess
function defined in module
FluxTraining
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().
stateaccess(::Type{HyperParameter})
Defines what
Learner state is accessed when calling
sethyperparameter! and
gethyperparameter. This is needed so that
Scheduler can access the state.
There are
21
methods for FluxTraining.stateaccess:
The following pages link back here:
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 , callbacks/trace.jl