|View source on GitHub|
Implements DPQuery interface for Gaussian sum queries.
tf_privacy.GaussianSumQuery( l2_norm_clip, stddev )
Clips records to bound the L2 norm, then adds Gaussian noise to the sum.
||The clipping norm to apply to the global norm of each record.|
||The stddev of the noise added to the sum.|
accumulate_preprocessed_record( sample_state, preprocessed_record )
accumulate_record( params, sample_state, record )
Accumulates a single record into the sample state.
This is a helper method that simply delegates to
accumulate_preprocessed_record for the common case when both of those
functions run on a single device. Typically this will be a simple sum.
||The parameters for the sample. In standard DP-SGD training, the clipping norm for the sample's microbatch gradients (i.e., a maximum norm magnitude to which each gradient is clipped)|
||The current sample state. In standard DP-SGD training, the accumulated sum of previous clipped microbatch gradients.|
||The record to accumulate. In standard DP-SGD training, the gradient computed for the examples in one microbatch, which may be the gradient for just one example (for size 1 microbatches).|
|The updated sample state. In standard DP-SGD training, the set of previous microbatch gradients with the addition of the record argument.|
derive_metrics( global_state )
Derives metric information from the current global state.
Any metrics returned should be derived only from privatized quantities.
||The global state from which to derive metrics.|
derive_sample_params( global_state )
get_noised_result( sample_state, global_state )
initial_sample_state( template=None )
make_global_state( l2_norm_clip, stddev )
Creates a global state from the given parameters.
merge_sample_states( sample_state_1, sample_state_2 )
preprocess_record( params, record )
preprocess_record_impl( params, record )
Clips the l2 norm, returning the clipped record and the l2 norm.
||The parameters for the sample.|
||The record to be processed.|
A tuple (preprocessed_records, l2_norm) where