def _prepare_dataset(self) -> None:
    '\n        Prepare the training, validation and test data.\n        '
    if (self.train_dataset is not None):
        self.num_train_examples = self.train_dataset.reduce(tf.constant(0), (lambda x, _: (x + 1))).numpy()
        if (self.args.max_steps > 0):
            self.train_steps = self.args.max_steps
        else:
            self.train_steps: int = math.ceil((self.num_train_examples / self.args.train_batch_size))
        self.train_dataset = self.train_dataset.cache().shuffle(self.num_train_examples).batch(self.args.train_batch_size).prefetch(tf.data.experimental.AUTOTUNE)
        if (self.args.max_steps > 0):
            self.train_dataset = self.train_dataset.repeat((- 1))
        self.train_dataset = self.args.strategy.experimental_distribute_dataset(self.train_dataset)
    else:
        self.train_steps = 0
    if (self.eval_dataset is not None):
        self.eval_dataset = self.eval_dataset.batch(self.args.eval_batch_size).cache().prefetch(tf.data.experimental.AUTOTUNE)
        self.eval_dataset = self.args.strategy.experimental_distribute_dataset(self.eval_dataset)
Prepare the training, validation and test data.
def _prepare_dataset(self) -> None:
    '\n        \n        '
    if (self.train_dataset is not None):
        self.num_train_examples = self.train_dataset.reduce(tf.constant(0), (lambda x, _: (x + 1))).numpy()
        if (self.args.max_steps > 0):
            self.train_steps = self.args.max_steps
        else:
            self.train_steps: int = math.ceil((self.num_train_examples / self.args.train_batch_size))
        self.train_dataset = self.train_dataset.cache().shuffle(self.num_train_examples).batch(self.args.train_batch_size).prefetch(tf.data.experimental.AUTOTUNE)
        if (self.args.max_steps > 0):
            self.train_dataset = self.train_dataset.repeat((- 1))
        self.train_dataset = self.args.strategy.experimental_distribute_dataset(self.train_dataset)
    else:
        self.train_steps = 0
    if (self.eval_dataset is not None):
        self.eval_dataset = self.eval_dataset.batch(self.args.eval_batch_size).cache().prefetch(tf.data.experimental.AUTOTUNE)
        self.eval_dataset = self.args.strategy.experimental_distribute_dataset(self.eval_dataset)