From 50673fec409d7c228771c6117040e4f2d008dc75 Mon Sep 17 00:00:00 2001 From: Zheng Xu Date: Thu, 12 Aug 2021 11:02:46 -0700 Subject: [PATCH] Minor fix for the nondeterministic seed of tree_aggregation.GaussianNoiseGenerator. The previous log results won't change much, while one seed is probably good enough. PiperOrigin-RevId: 390412713 --- tensorflow_privacy/privacy/dp_query/tree_aggregation.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tensorflow_privacy/privacy/dp_query/tree_aggregation.py b/tensorflow_privacy/privacy/dp_query/tree_aggregation.py index 6015545..c0a02fc 100644 --- a/tensorflow_privacy/privacy/dp_query/tree_aggregation.py +++ b/tensorflow_privacy/privacy/dp_query/tree_aggregation.py @@ -94,10 +94,12 @@ class GaussianNoiseGenerator(ValueGenerator): An initial state. """ if self.seed is None: + time_now = tf.timestamp() + residual = time_now - tf.math.floor(time_now) return tf.cast( tf.stack([ tf.math.floor(tf.timestamp() * 1e6), - tf.math.floor(tf.math.log(tf.timestamp() * 1e6)) + tf.math.floor(residual * 1e9) ]), dtype=tf.int64) else: