tf.keras.constraints.RadialConstraint
Stay organized with collections
Save and categorize content based on your preferences.
Constrains Conv2D
kernel weights to be the same for each radius.
Inherits From: Constraint
Also available via the shortcut function
tf.keras.constraints.radial_constraint
.
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
get_config
View source
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.
Returns |
Python dict containing the configuration of the constraint object.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2021-08-16 UTC.
[null,null,["Last updated 2021-08-16 UTC."],[],[],null,["# tf.keras.constraints.RadialConstraint\n\n\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [TensorFlow 1 version](/versions/r1.15/api_docs/python/tf/keras/constraints/RadialConstraint) | [View source on GitHub](https://github.com/keras-team/keras/tree/master/keras/constraints.py#L225-L302) |\n\nConstrains `Conv2D` kernel weights to be the same for each radius.\n\nInherits From: [`Constraint`](../../../tf/keras/constraints/Constraint)\n\n#### View aliases\n\n\n**Main aliases**\n\n[`tf.keras.constraints.radial_constraint`](https://www.tensorflow.org/api_docs/python/tf/keras/constraints/RadialConstraint)\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.keras.constraints.RadialConstraint`](https://www.tensorflow.org/api_docs/python/tf/keras/constraints/RadialConstraint), [`tf.compat.v1.keras.constraints.radial_constraint`](https://www.tensorflow.org/api_docs/python/tf/keras/constraints/RadialConstraint)\n\n\u003cbr /\u003e\n\nAlso available via the shortcut function\n[`tf.keras.constraints.radial_constraint`](../../../tf/keras/constraints/RadialConstraint).\n\nFor example, the desired output for the following 4-by-4 kernel: \n\n kernel = [[v_00, v_01, v_02, v_03],\n [v_10, v_11, v_12, v_13],\n [v_20, v_21, v_22, v_23],\n [v_30, v_31, v_32, v_33]]\n\nis this:: \n\n kernel = [[v_11, v_11, v_11, v_11],\n [v_11, v_33, v_33, v_11],\n [v_11, v_33, v_33, v_11],\n [v_11, v_11, v_11, v_11]]\n\nThis constraint can be applied to any `Conv2D` layer version, including\n`Conv2DTranspose` and `SeparableConv2D`, and with either `\"channels_last\"` or\n`\"channels_first\"` data format. The method assumes the weight tensor is of\nshape `(rows, cols, input_depth, output_depth)`.\n\nMethods\n-------\n\n### `get_config`\n\n[View source](https://github.com/keras-team/keras/tree/master/keras/constraints.py#L67-L76) \n\n get_config()\n\nReturns a Python dict of the object config.\n\nA constraint config is a Python dictionary (JSON-serializable) that can\nbe used to reinstantiate the same object.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| Python dict containing the configuration of the constraint object. ||\n\n\u003cbr /\u003e"]]