class_docstr: Implements DPQuery interface for discrete distributed sum queries.
  
  This implementation is for the distributed queries where the Skellam noise
  is applied locally to a discrete vector that matches the norm bound.
class_docstr_tok: ["Implements","DPQuery","interface","for","discrete","distributed","sum","queries",".","This","implementation","is","for","the","distributed","queries","where","the","Skellam","noise","is","applied","locally","to","a","discrete","vector","that","matches","the","norm","bound","."]
docstr: Adds Skellam noise to the sample.
  
  We use difference of two Poisson random variable with lambda hyperparameter
  that equals 'local_stddev**2/2' that results in a standard deviation
  'local_stddev' for the Skellam noise to be added locally.
  
  Args:
    local_stddev: The standard deviation of the local Skellam noise.
    record: The record to be processed.
  
  Returns:
    A record with added noise.
docstr_tok: ["Adds","Skellam","noise","to","the","sample",".","We","use","difference","of","two","Poisson","random","variable","with","lambda","hyperparameter","that","equals","'local_stddev","*","*","2\/2","'","that","results","in","a","standard","deviation","'local_stddev","'","for","the","Skellam","noise","to","be","added","locally",".","Args",":","local_stddev",":","The","standard","deviation","of","the","local","Skellam","noise",".","record",":","The","record","to","be","processed",".","Returns",":","A","record","with","added","noise","."]
code: def add_noise_to_sample(self, local_stddev, record):
      """Adds Skellam noise to the sample.
  
      We use difference of two Poisson random variable with lambda hyperparameter
      that equals 'local_stddev**2/2' that results in a standard deviation
      'local_stddev' for the Skellam noise to be added locally.
  
      Args:
        local_stddev: The standard deviation of the local Skellam noise.
        record: The record to be processed.
  
      Returns:
        A record with added noise.
      """
      # Use float64 as the stddev could be large after quantization.
      local_stddev = tf.cast(local_stddev, tf.float64)
      poisson_lam = 0.5 * local_stddev * local_stddev
  
      def add_noise(v):
          poissons = tf.random.stateless_poisson(
              shape=tf.concat(
                  [tf.shape(v), [2]], axis=0
              ),  # Two draws of Poisson.
              seed=tf.cast([tf.timestamp() * 10**6, 0], tf.int64),
              lam=[poisson_lam, poisson_lam],
              dtype=tf.int64,
          )
          return v + tf.cast(
              poissons[..., 0] - poissons[..., 1], v.dtype
          )
  
      return tf.nest.map_structure(add_noise, record)
  
file_path: privacy/tensorflow_privacy/privacy/dp_query/distributed_skellam_query.py
imports: import collections
  import dp_accounting
  import tensorflow
  from tensorflow_privacy.privacy.dp_query import dp_query
  from tensorflow_privacy.privacy.dp_query import normalized_query
label_desc: Use image node_id 4 for calling the DistributedSkellamSumQuery obj's underlying member method code with example usage: obj.add_noise_to_sample(local_stddev, record) and returns: tf, unknown