(
self, model, x=None, y=None, batch_size=None, epochs=1, verbose=1,
callbacks=None, validation_split=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,
max_queue_size=10, workers=1, use_multiprocessing=False, **kwargs)
| 189 | """ |
| 190 | |
| 191 | def fit( |
| 192 | self, model, x=None, y=None, batch_size=None, epochs=1, verbose=1, |
| 193 | callbacks=None, validation_split=0., validation_data=None, shuffle=True, |
| 194 | class_weight=None, sample_weight=None, initial_epoch=0, |
| 195 | steps_per_epoch=None, validation_steps=None, validation_freq=1, |
| 196 | max_queue_size=10, workers=1, use_multiprocessing=False, **kwargs): |
| 197 | batch_size = model._validate_or_infer_batch_size( |
| 198 | batch_size, steps_per_epoch, x) |
| 199 | |
| 200 | strategy = _get_distribution_strategy(model) |
| 201 | batch_size, steps_per_epoch = dist_utils.process_batch_and_step_size( |
| 202 | strategy, |
| 203 | x, |
| 204 | batch_size, |
| 205 | steps_per_epoch, |
| 206 | ModeKeys.TRAIN, |
| 207 | validation_split=validation_split) |
| 208 | dist_utils.validate_callbacks(input_callbacks=callbacks, |
| 209 | optimizer=model.optimizer) |
| 210 | # Enter tf.distribute.Strategy scope. |
| 211 | with strategy.scope(): |
| 212 | training_data_adapter, validation_adapter = _process_training_inputs( |
| 213 | model, |
| 214 | x, |
| 215 | y, |
| 216 | batch_size=batch_size, |
| 217 | epochs=epochs, |
| 218 | sample_weights=sample_weight, |
| 219 | class_weights=class_weight, |
| 220 | validation_split=validation_split, |
| 221 | steps_per_epoch=steps_per_epoch, |
| 222 | shuffle=shuffle, |
| 223 | validation_data=validation_data, |
| 224 | validation_steps=validation_steps, |
| 225 | distribution_strategy=strategy, |
| 226 | max_queue_size=max_queue_size, |
| 227 | workers=workers, |
| 228 | use_multiprocessing=use_multiprocessing) |
| 229 | |
| 230 | total_samples = _get_total_number_of_samples(training_data_adapter) |
| 231 | use_sample = total_samples is not None |
| 232 | do_validation = (validation_adapter is not None) |
| 233 | |
| 234 | recreate_training_iterator = ( |
| 235 | training_data_adapter.should_recreate_iterator(steps_per_epoch)) |
| 236 | if not steps_per_epoch: |
| 237 | # TODO(b/139762795): Add step inference for when steps is None to |
| 238 | # prevent end of sequence warning message. |
| 239 | steps_per_epoch = training_data_adapter.get_size() |
| 240 | |
| 241 | # tf.print('{} on {} steps.'.format(ModeKeys.TRAIN, steps_per_epoch)) |
| 242 | training_context = TrainingContext() |
| 243 | |
| 244 | initial_epoch = model._maybe_load_initial_epoch_from_ckpt( |
| 245 | initial_epoch, ModeKeys.TRAIN) |
| 246 | |
| 247 | training_dataset = training_data_adapter.get_dataset() |
| 248 | # Raise an error if steps_per_epoch isn't specified but the dataset |
nothing calls this directly
no test coverage detected