# tfc.layers.IdentityInitializer

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/compression/blob/v2.14.1/tensorflow_compression/python/layers/initializers.py#L25-L55) |

Initialize to the identity kernel with the given shape.

#### View aliases


**Main aliases**

[`tfc.IdentityInitializer`](https://www.tensorflow.org/api_docs/python/tfc/layers/IdentityInitializer)

<br />

    tfc.layers.IdentityInitializer(
        gain=1
    )

This creates an n-D kernel suitable for `SignalConv*` with the requested
support that produces an output identical to its input (except possibly at the
signal boundaries).

> [!NOTE]
> **Note:** The identity initializer in [`tf.keras.initializers`](https://www.tensorflow.org/api_docs/python/tf/keras/initializers) is only suitable for matrices, not for n-D convolution kernels (i.e., no spatial support).

## Methods

### `from_config`

    @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, the output of `get_config()`. |

<br />

<br />

<br />

<br />

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

<br />

### `get_config`

[View source](https://github.com/tensorflow/compression/blob/v2.14.1/tensorflow_compression/python/layers/initializers.py#L52-L55)

    get_config()

Returns the initializer's configuration as a JSON-serializable dict.

<br />

<br />

<br />

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

<br />

### `__call__`

[View source](https://github.com/tensorflow/compression/blob/v2.14.1/tensorflow_compression/python/layers/initializers.py#L40-L50)

    __call__(
        shape, dtype=None, **kwargs
    )

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. |
| `**kwargs` | Additional keyword arguments. |

<br />