tf.raw_ops.EnsureShape

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

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.

Args:

  • 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).

Returns:

A Tensor. Has the same type as input.