tff.simulation.datasets.build_dataset_mixture

Build a new dataset that probabilistically returns examples.

a the first tf.data.Dataset.
b the second tf.data.Dataset.
a_probability the float probability to select the next example from the a dataset.
op_seed an optional int seed for the TensorFlow PRNG op. Strongly recommended to only use in unittests. Note: only setting this seed will not enable deterministic behavior, callers must also use tf.random.set_seed to enable deterministic behavior.

A tf.data.Dataset that returns examples from dataset a with probability a_probability, and examples form dataset b with probability (1 - a_probability). The dataset will yield the number of examples equal to the smaller of a or b.