# tf.keras.constraints.NonNeg

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 2 version](https://www.tensorflow.org/api_docs/python/tf/keras/constraints/NonNeg) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/keras/constraints.py#L82-L87) |

Constrains the weights to be non-negative.

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

#### View aliases


**Main aliases**

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

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

[`tf.compat.v1.keras.constraints.NonNeg`](https://www.tensorflow.org/api_docs/python/tf/keras/constraints/NonNeg), [`tf.compat.v1.keras.constraints.non_neg`](https://www.tensorflow.org/api_docs/python/tf/keras/constraints/NonNeg), \`tf.compat.v2.keras.constraints.NonNeg\`, \`tf.compat.v2.keras.constraints.non_neg\`

<br />

## Methods

### `get_config`

[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/keras/constraints.py#L40-L41)

    get_config()

### `__call__`

[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/keras/constraints.py#L86-L87)

    __call__(
        w
    )

Call self as a function.