# tf.raw_ops.EnsureShape

<br />

Ensures that the tensor's shape matches the expected shape.

#### View aliases


**Compat aliases for migration**

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

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

<br />

    tf.raw_ops.EnsureShape(
        input, shape, name=None
    )

Raises an error if the input tensor's shape does not match the specified shape.
Returns the input tensor otherwise.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `input` | A `Tensor`. A tensor, whose shape is to be validated. |
| `shape` | A [`tf.TensorShape`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/TensorShape) or list of `ints`. The expected (possibly partially specified) shape of the input tensor. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A `Tensor`. Has the same type as `input`. ||

<br />