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.

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.

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/raw_ops/EnsureShape