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.

Extending

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() .

Methods

There are 19 methods for stateaccess:

stateaccess(::FluxTraining.SafeCallback)
callbacks/callback.jl:77
stateaccess(::MetricsPrinter)
callbacks/callbacks.jl:63
stateaccess(::StopOnNaNLoss)
callbacks/callbacks.jl:82
stateaccess(::ProgressPrinter)
callbacks/callbacks.jl:32
stateaccess(::ToDevice)
callbacks/callbacks.jl:106
stateaccess(cc::ConditionalCallback)
callbacks/conditional.jl:63
stateaccess(cc::CustomCallback)
callbacks/custom.jl:32
stateaccess(::EarlyStopping)
callbacks/earlystopping.jl:77
stateaccess(::Type{LearningRate})
callbacks/hyperparameters.jl:43
stateaccess(::Type{FluxTraining.HyperParameter})
callbacks/hyperparameters.jl:29
stateaccess(::Checkpointer)
callbacks/logging/checkpointer.jl:19
stateaccess(::LogVisualization)
callbacks/logging/logger.jl:208
stateaccess(::LogHistograms)
callbacks/logging/logger.jl:152
stateaccess(::LogHyperParams)
callbacks/logging/logger.jl:113
stateaccess(::LogMetrics)
callbacks/logging/logger.jl:57
stateaccess(::Metrics)
callbacks/metrics.jl:45
stateaccess(::Recorder)
callbacks/recorder.jl:18
stateaccess(::SanityCheck)
callbacks/sanitycheck.jl:66
stateaccess(scheduler::Scheduler)
callbacks/scheduler.jl:30