# tf_privacy.tree_aggregation.GaussianNoiseGenerator

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/privacy/blob/v0.9.0/privacy/privacy/dp_query/tree_aggregation.py#L65-L138) |

Gaussian noise generator with counter as pseudo state.

Inherits From: [`ValueGenerator`](https://www.tensorflow.org/responsible_ai/privacy/api_docs/python/tf_privacy/tree_aggregation/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`](https://www.tensorflow.org/api_docs/python/tf/TensorSpec)s.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `noise_std` | The standard deviation of the noise. |
| `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. |
| `seed` | An optional integer seed. If None, generator is seeded from the clock. |

<br />

## Methods

### `initialize`

[View source](https://github.com/tensorflow/privacy/blob/v0.9.0/privacy/privacy/dp_query/tree_aggregation.py#L92-L111)

    initialize()

Makes an initial state for the GaussianNoiseGenerator.

<br />

<br />

<br />

| Returns ||
|---|---|
| A named tuple of (seeds, stddev). ||

<br />

### `make_state`

[View source](https://github.com/tensorflow/privacy/blob/v0.9.0/privacy/privacy/dp_query/tree_aggregation.py#L134-L138)

    make_state(
        seeds: tf.Tensor, stddev: tf.Tensor
    )

Returns a new named tuple of (seeds, stddev).

### `next`

[View source](https://github.com/tensorflow/privacy/blob/v0.9.0/privacy/privacy/dp_query/tree_aggregation.py#L113-L132)

    next(
        state
    )

Gets next value and advances the GaussianNoiseGenerator.

<br />

<br />

<br />

| Args ||
|---|---|
| `state` | The current state (seed, noise_std). |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A tuple of (sample, new_state) where sample is a new sample and new_state is the advanced state (seed+1, noise_std). ||

<br />