W3cubDocs

/TensorFlow Python

tf.contrib.data.assert_element_shape

tf.contrib.data.assert_element_shape(expected_shapes)

Defined in tensorflow/contrib/data/python/ops/batching.py.

Assert the shape of this Dataset.

shapes = [tf.TensorShape([16, 256]), tf.TensorShape(None)]
result = dataset.apply(tf.contrib.data.assert_element_shape(shapes))
print(result.output_shapes)  # ==> "((16, 256), <unknown>)"

If dataset shapes and expected_shape, are fully defined, assert they match. Otherwise, add assert op that will validate the shapes when tensors are evaluated, and set shapes on tensors, respectively.

Args:

Returns:

A Dataset transformation function, which can be passed to tf.data.Dataset.apply

© 2018 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/api_docs/python/tf/contrib/data/assert_element_shape