Save the date! Google I/O returns May 18-20 Register now

View source on GitHub

Asserts the cardinality of the input dataset.

dataset ="examples.tfrecord")
cardinality =
print((cardinality ==
dataset = dataset.apply(

expected_cardinality The expected cardinality of the input dataset.

A Dataset transformation function, which can be passed to

FailedPreconditionError The assertion is checked at runtime (when iterating the dataset) and an error is raised if the actual and expected cardinality differ.