# tf.keras.initializers.TruncatedNormal

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 1 version](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/keras/initializers/TruncatedNormal) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/ops/init_ops_v2.py#L294-L338) |

Initializer that generates a truncated normal distribution.

Inherits From: [`Initializer`](https://www.tensorflow.org/versions/r2.1/api_docs/python/tf/keras/initializers/Initializer)

#### View aliases


**Main aliases**

[`tf.initializers.TruncatedNormal`](https://www.tensorflow.org/api_docs/python/tf/keras/initializers/TruncatedNormal)

<br />

    tf.keras.initializers.TruncatedNormal(
        mean=0.0, stddev=0.05, seed=None
    )

These values are similar to values from a `random_normal_initializer`
except that values more than two standard deviations from the mean
are discarded and re-drawn. This is the recommended initializer for
neural network weights and filters.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `mean` | a python scalar or a scalar tensor. Mean of the random values to generate. |
| `stddev` | a python scalar or a scalar tensor. Standard deviation of the random values to generate. |
| `seed` | A Python integer. Used to create random seeds. See [`tf.compat.v1.set_random_seed`](https://www.tensorflow.org/versions/r2.1/api_docs/python/tf/compat/v1/set_random_seed) for behavior. |

<br />

## Methods

### `from_config`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/ops/init_ops_v2.py#L69-L89)

    @classmethod
    from_config(
        config
    )

Instantiates an initializer from a configuration dictionary.

#### Example:

    initializer = RandomUniform(-1, 1)
    config = initializer.get_config()
    initializer = RandomUniform.from_config(config)

<br />

<br />

<br />

| Args ||
|---|---|
| `config` | A Python dictionary. It will typically be the output of `get_config`. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| An Initializer instance. ||

<br />

### `get_config`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/ops/init_ops_v2.py#L333-L338)

    get_config()

Returns the configuration of the initializer as a JSON-serializable dict.

<br />

<br />

<br />

| Returns ||
|---|---|
| A JSON-serializable Python dict. ||

<br />

### `__call__`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/ops/init_ops_v2.py#L318-L331)

    __call__(
        shape, dtype=tf.dtypes.float32
    )

Returns a tensor object initialized as specified by the initializer.

<br />

<br />

<br />

| Args ||
|---|---|
| `shape` | Shape of the tensor. |
| `dtype` | Optional dtype of the tensor. Only floating point types are supported. |

<br />

<br />

<br />

<br />

| Raises ||
|---|---|
| `ValueError` | If the dtype is not floating point |

<br />