# tensorflow::ops::EnsureShape Class Reference

# tensorflow::
ops::
EnsureShape

`
#include <array_ops.h>
`


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

## Summary


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


Args:

- scope: A [Scope](https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object
- input: A tensor, whose shape is to be validated.
- shape: The expected (possibly partially specified) shape of the input tensor.

<br />


Returns:

- `
  https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output
  ` : A tensor with the same shape and contents as the input tensor or value.

<br />

| ### Constructors and Destructors ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/ensure-shape#classtensorflow_1_1ops_1_1_ensure_shape_1a5eccae9b4752e5ce978003d1413e5c06 (const :: https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, :: https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input input, PartialTensorShape shape) ` ||

| ### Public attributes ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/ensure-shape#classtensorflow_1_1ops_1_1_ensure_shape_1abc933208d9ec4b02b93fd9fbf992457b ` | ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation ` |
| ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/ensure-shape#classtensorflow_1_1ops_1_1_ensure_shape_1a3de25be53998f6b3c1fe4f88c0b7f90a ` | ` :: https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output ` |

| ### Public functions ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/ensure-shape#classtensorflow_1_1ops_1_1_ensure_shape_1affd7b08d440e2fcd688949c62b747b6d () const ` | ` ::tensorflow::Node * ` |
| ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/ensure-shape#classtensorflow_1_1ops_1_1_ensure_shape_1afd5278e7b8083f310fa151d3e6ca6569 () const ` | ` ` |
| ` https://www.tensorflow.org/versions/r2.6/api_docs/cc/class/tensorflow/ops/ensure-shape#classtensorflow_1_1ops_1_1_ensure_shape_1a9ced601bdda49a6b52e0695a81bdee19 () const ` | ` ` |

## Public attributes

### operation

```
Operation operation
```

### output

```
::tensorflow::Output output
```

## Public functions

### EnsureShape

```
 EnsureShape(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  PartialTensorShape shape
)
```

### node

```
::tensorflow::Node * node() const 
```

### operator::tensorflow::Input

```
 operator::tensorflow::Input() const 
```

### operator::tensorflow::Output

```
 operator::tensorflow::Output() const 
```