Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support accurate dataset length computation in TFDSDataset components in TF2.3 #172

Open
AdamHillier opened this issue Jul 28, 2020 · 0 comments

Comments

@AdamHillier
Copy link
Contributor

From the TF 2.3 release notes:

  • tf.data.experimental.cardinality is now a method on tf.data.Dataset.
  • tf.data.Dataset now supports len(Dataset) when the cardinality is finite.

We should make use of these functions here:

def num_examples(self, split) -> int:
"""Compute the number of examples in a given split."""
return sum(self.splits[s].num_examples for s in base_splits(split))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant