Small refactor to improve the readability of the Model class for those who use the code as documentation.

General idea: most important methods come first, private utilities are moved to the bottom of the class.
Also use a single method for `_standardize_user_data` (previously split into 2 methods that did not reflect
two separate sets of actions).

PiperOrigin-RevId: 225094903
This commit is contained in:
Francois Chollet 2018-12-11 16:45:06 -08:00 committed by TensorFlower Gardener
parent a54fd6b713
commit e8c65fa77f
2 changed files with 968 additions and 1022 deletions

File diff suppressed because it is too large Load Diff

View File

@ -570,11 +570,8 @@ def _get_input_from_iterator(iterator, model):
# Validate that all the elements in x and y are of the same type and shape.
# We can then pass the first element of x and y to `_standardize_weights`
# below and be confident of the output.
x_values, y_values, sample_weights_values = distributed_training_utils.\
validate_distributed_dataset_inputs(model._distribution_strategy, x, y,
sample_weights)
model._standardize_weights(x_values, y_values,
sample_weight=sample_weights_values)
distributed_training_utils.validate_distributed_dataset_inputs(
model._distribution_strategy, x, y, sample_weights)
return x, y, sample_weights