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

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


			stateaccess(::Type{HyperParameter})

Defines what Learner state is accessed when calling sethyperparameter! and gethyperparameter. This is needed so that Scheduler can access the state.