# tf.random_uniform_initializer

<br />

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

Initializer that generates tensors with a uniform distribution.

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

#### View aliases


**Main aliases**

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

<br />

    tf.random_uniform_initializer(
        minval=-0.05, maxval=0.05, seed=None
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `minval` | A python scalar or a scalar tensor. Lower bound of the range of random values to generate. |
| `maxval` | A python scalar or a scalar tensor. Upper bound of the range of random values to generate. Defaults to 1 for float types. |
| `seed` | A Python integer. Used to create random seeds. See [`tf.compat.v1.set_random_seed`](https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/compat/v1/set_random_seed) for behavior. |

<br />

## Methods

### `from_config`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.0.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.0.0/tensorflow/python/ops/init_ops_v2.py#L255-L260)

    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.0.0/tensorflow/python/ops/init_ops_v2.py#L238-L253)

    __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 and integer types are supported. |

<br />

<br />

<br />

<br />

| Raises ||
|---|---|
| `ValueError` | If the dtype is not numeric. |

<br />