tf_privacy.tree_aggregation.GaussianNoiseGenerator
Stay organized with collections
Save and categorize content based on your preferences.
Gaussian noise generator with counter as pseudo state.
Inherits From: ValueGenerator
tf_privacy.tree_aggregation.GaussianNoiseGenerator(
noise_std: float,
specs: Collection[tf.TensorSpec],
seed: Optional[int] = None
)
Produces i.i.d. spherical Gaussian noise at each step shaped according to a
nested structure of tf.TensorSpec
s.
Args |
noise_std
|
The standard deviation of the noise.
|
specs
|
A nested structure of tf.TensorSpec s specifying the shape of the
noise to generate.
|
seed
|
An optional integer seed. If None, generator is seeded from the
clock.
|
Methods
initialize
View source
initialize()
Makes an initial state for the GaussianNoiseGenerator.
Returns |
A named tuple of (seeds, stddev).
|
make_state
View source
make_state(
seeds: tf.Tensor, stddev: tf.Tensor
)
Returns a new named tuple of (seeds, stddev).
next
View source
next(
state
)
Gets next value and advances the GaussianNoiseGenerator.
Args |
state
|
The current state (seed, noise_std).
|
Returns |
A tuple of (sample, new_state) where sample is a new sample and new_state
is the advanced state (seed+1, noise_std).
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-02-16 UTC.
[null,null,["Last updated 2024-02-16 UTC."],[],[],null,["# tf_privacy.tree_aggregation.GaussianNoiseGenerator\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/privacy/blob/v0.9.0/privacy/privacy/dp_query/tree_aggregation.py#L65-L138) |\n\nGaussian noise generator with counter as pseudo state.\n\nInherits From: [`ValueGenerator`](../../tf_privacy/tree_aggregation/ValueGenerator) \n\n tf_privacy.tree_aggregation.GaussianNoiseGenerator(\n noise_std: float,\n specs: Collection[tf.TensorSpec],\n seed: Optional[int] = None\n )\n\nProduces i.i.d. spherical Gaussian noise at each step shaped according to a\nnested structure of [`tf.TensorSpec`](https://www.tensorflow.org/api_docs/python/tf/TensorSpec)s.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------|\n| `noise_std` | The standard deviation of the noise. |\n| `specs` | A nested structure of [`tf.TensorSpec`](https://www.tensorflow.org/api_docs/python/tf/TensorSpec)s specifying the shape of the noise to generate. |\n| `seed` | An optional integer seed. If None, generator is seeded from the clock. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `initialize`\n\n[View source](https://github.com/tensorflow/privacy/blob/v0.9.0/privacy/privacy/dp_query/tree_aggregation.py#L92-L111) \n\n initialize()\n\nMakes an initial state for the GaussianNoiseGenerator.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| A named tuple of (seeds, stddev). ||\n\n\u003cbr /\u003e\n\n### `make_state`\n\n[View source](https://github.com/tensorflow/privacy/blob/v0.9.0/privacy/privacy/dp_query/tree_aggregation.py#L134-L138) \n\n make_state(\n seeds: tf.Tensor, stddev: tf.Tensor\n )\n\nReturns a new named tuple of (seeds, stddev).\n\n### `next`\n\n[View source](https://github.com/tensorflow/privacy/blob/v0.9.0/privacy/privacy/dp_query/tree_aggregation.py#L113-L132) \n\n next(\n state\n )\n\nGets next value and advances the GaussianNoiseGenerator.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|---------|--------------------------------------|\n| `state` | The current state (seed, noise_std). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| A tuple of (sample, new_state) where sample is a new sample and new_state is the advanced state (seed+1, noise_std). ||\n\n\u003cbr /\u003e"]]