tf.raw_ops.EnsureShape

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

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

input A Tensor. A tensor, whose shape is to be validated.
shape A tf.TensorShape or list of ints. The expected (possibly partially specified) shape of the input tensor.
name A name for the operation (optional).

A Tensor. Has the same type as input.