Skip to content

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

Open
@AdamHillier

Description

@AdamHillier
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))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @AdamHillier

        Issue actions

          Support accurate dataset length computation in `TFDSDataset` components in TF2.3 · Issue #172 · larq/zookeeper