# tf.keras.constraints.RadialConstraint

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v2.13.1/keras/constraints.py#L254-L341) |

Constrains `Conv2D` kernel weights to be the same for each radius.

Inherits From: [`Constraint`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/keras/constraints/Constraint)

#### View aliases


**Main aliases**

[`tf.keras.constraints.radial_constraint`](https://www.tensorflow.org/api_docs/python/tf/keras/constraints/RadialConstraint)
**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

\`tf.compat.v1.keras.constraints.RadialConstraint\`, \`tf.compat.v1.keras.constraints.radial_constraint\`

<br />

Also available via the shortcut function
[`tf.keras.constraints.radial_constraint`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/keras/constraints/RadialConstraint).

For example, the desired output for the following 4-by-4 kernel:

        kernel = [[v_00, v_01, v_02, v_03],
                  [v_10, v_11, v_12, v_13],
                  [v_20, v_21, v_22, v_23],
                  [v_30, v_31, v_32, v_33]]

is this::

        kernel = [[v_11, v_11, v_11, v_11],
                  [v_11, v_33, v_33, v_11],
                  [v_11, v_33, v_33, v_11],
                  [v_11, v_11, v_11, v_11]]

This constraint can be applied to any `Conv2D` layer version, including
`Conv2DTranspose` and `SeparableConv2D`, and with either `"channels_last"`
or `"channels_first"` data format. The method assumes the weight tensor is
of shape `(rows, cols, input_depth, output_depth)`.

## Methods

### `from_config`

[View source](https://github.com/keras-team/keras/tree/v2.13.1/keras/constraints.py#L83-L101)

    @classmethod
    from_config(
        config
    )

Instantiates a weight constraint from a configuration dictionary.

#### Example:

    constraint = UnitNorm()
    config = constraint.get_config()
    constraint = UnitNorm.from_config(config)

<br />

<br />

<br />

| Args ||
|---|---|
| `config` | A Python dictionary, the output of `get_config`. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A [`tf.keras.constraints.Constraint`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/keras/constraints/Constraint) instance. ||

<br />

### `get_config`

[View source](https://github.com/keras-team/keras/tree/v2.13.1/keras/constraints.py#L72-L81)

    get_config()

Returns a Python dict of the object config.

A constraint config is a Python dictionary (JSON-serializable) that can
be used to reinstantiate the same object.

<br />

<br />

<br />

| Returns ||
|---|---|
| Python dict containing the configuration of the constraint object. ||

<br />