<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/ops/numpy.py#L6624-L6638) |

Return a tensor of ones with the same shape and type of `x`.

#### View aliases


**Main aliases**

[`tf.keras.ops.numpy.ones_like`](https://www.tensorflow.org/api_docs/python/tf/keras/ops/ones_like)

<br />

    tf.keras.ops.ones_like(
        x, dtype=None
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | Input tensor. |
| `dtype` | Overrides the data type of the result. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A tensor of ones with the same shape and type as `x`. ||

<br />