class_docstr: Implements DPQuery for discrete distributed Gaussian sum queries.
  
  For each local record, we check the L2 norm bound and add discrete Gaussian
  noise. In particular, this DPQuery does not perform L2 norm clipping and the
  norms of the input records are expected to be bounded.
class_docstr_tok: ["Implements","DPQuery","for","discrete","distributed","Gaussian","sum","queries",".","For","each","local","record",",","we","check","the","L2","norm","bound","and","add","discrete","Gaussian","noise",".","In","particular",",","this","DPQuery","does","not","perform","L2","norm","clipping","and","the","norms","of","the","input","records","are","expected","to","be","bounded","."]
docstr: Check record norm and add noise to the record.
docstr_tok: ["Check","record","norm","and","add","noise","to","the","record","."]
code: def preprocess_record(self, params, record):
      """Check record norm and add noise to the record."""
      record_as_list = tf.nest.flatten(record)
      record_as_float_list = [
          tf.cast(x, tf.float32) for x in record_as_list
      ]
      tf.nest.map_structure(
          lambda x: tf.compat.v1.assert_type(x, tf.int32),
          record_as_list,
      )
      dependencies = [
          tf.compat.v1.assert_less_equal(
              tf.linalg.global_norm(record_as_float_list),
              params.l2_norm_bound,
              message=f"Global L2 norm exceeds {params.l2_norm_bound}.",
          )
      ]
      with tf.control_dependencies(dependencies):
          result = tf.cond(
              tf.equal(params.local_stddev, 0),
              lambda: record,
              lambda: self._add_local_noise(
                  record, params.local_stddev
              ),
          )
          return result
  
file_path: privacy/tensorflow_privacy/privacy/dp_query/distributed_discrete_gaussian_query.py
imports: import collections
  import dp_accounting
  import tensorflow
  from tensorflow_privacy.privacy.dp_query import discrete_gaussian_utils
  from tensorflow_privacy.privacy.dp_query import dp_query
label_desc: Use image node_id 5 for calling the DistributedDiscreteGaussianSumQuery obj's underlying member method code with example usage: obj.preprocess_record(params, record) and returns: result