<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/backend/__init__.py#L70-L72) |

Creates a sub-namespace for variable paths.

#### View aliases


**Compat aliases for migration**

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

[`tf.compat.v1.keras.name_scope`](https://www.tensorflow.org/api_docs/python/tf/keras/name_scope)

<br />

    tf.keras.name_scope(
        name, **kwargs
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `name` | Name of the current scope (string). |
| `caller` | Optional ID of a caller object (e.g. class instance). |
| `deduplicate` | If `True`, if `caller` was passed, and the previous caller matches the current caller, and the previous name matches the current name, do not reenter a new namespace. |
| `override_parent` | Can be used to provide an absolute path which would override any previously opened name scopes. |

<br />

## Methods

### `__enter__`

[View source](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/backend/tensorflow/core.py#L864-L880)

    __enter__()

### `__exit__`

[View source](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/backend/tensorflow/core.py#L882-L885)

    __exit__(
        *args, **kwargs
    )