|View source on GitHub|
Assert tensor shapes and dimension size relationships between tensors.
tf.compat.v1.debugging.assert_shapes( shapes, data=None, summarize=None, message=None, name=None )
This Op checks that a collection of tensors shape relationships satisfies given constraints.
n = 10
q = 3
d = 7
x = tf.zeros([n,q])
y = tf.ones([n,d])
param = tf.Variable([1.0, 2.0, 3.0])
scalar = 1.0
(x, ('N', 'Q')),
(y, ('N', 'D')),
(x, ('N', 'D')),
(y, ('N', 'D'))
Traceback (most recent call last):
Example of adding a dependency to an operation:
with tf.control_dependencies([tf.assert_shapes(shapes)]): output = tf.matmul(x, y, transpose_a=True)
scalar does not have a shape that satisfies
all specified constraints,
message, as well as the first
of the first encountered violating tensor are printed, and
InvalidArgumentError is raised.
Size entries in the specified shapes are checked against other entries by their hash, except:
- a size entry is interpreted as an explicit size if it can be parsed as an integer primitive.
- a size entry is interpreted as any size if it is None or '.'.
If the first entry of a shape is