Migrate to use dataset.cardinality.
Migrate to use dataset.cardinality.

The functionality is identical. We plan to deprecate tf.data.experimental.cardinality in the near future, so this will avoid a deprecation warning.

PiperOrigin-RevId: 315305120

tensorflow/neural-structured-learning,tensorflow/neural-structured-learning,tensorflow/neural-structured-learning