def evaluate(self,
              model,
              x=None,
              y=None,
              batch_size=None,
              verbose=1,
              sample_weight=None,
              steps=None,
              callbacks=None,
              **kwargs):
   model._validate_or_infer_batch_size(batch_size, steps, x)
   # Make sure that y, sample_weights, validation_split are not passed.
   training_utils_v1.validate_dataset_input(x, y, sample_weight)
   return evaluate_generator(
       model, x, steps=steps, verbose=verbose, workers=0, callbacks=callbacks)
Exemple #2
0
    def fit(self,
            model,
            x=None,
            y=None,
            batch_size=None,
            epochs=1,
            verbose=1,
            callbacks=None,
            validation_split=0.0,
            validation_data=None,
            shuffle=True,
            class_weight=None,
            sample_weight=None,
            initial_epoch=0,
            steps_per_epoch=None,
            validation_steps=None,
            validation_freq=1,
            **kwargs):
        model._validate_or_infer_batch_size(batch_size, steps_per_epoch, x)
        # Make sure that y, sample_weights, validation_split are not passed.
        training_utils_v1.validate_dataset_input(x, y, sample_weight,
                                                 validation_split)
        if (isinstance(x, (tf.compat.v1.data.Dataset, tf.data.Dataset))
                and shuffle):
            training_utils_v1.verify_dataset_shuffled(x)

        return fit_generator(
            model,
            x,
            steps_per_epoch=steps_per_epoch,
            epochs=epochs,
            verbose=verbose,
            callbacks=callbacks,
            validation_data=validation_data,
            validation_steps=validation_steps,
            validation_freq=validation_freq,
            class_weight=class_weight,
            workers=0,
            shuffle=shuffle,
            initial_epoch=initial_epoch,
            steps_name="steps_per_epoch",
        )