MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _standardize_user_data

Method _standardize_user_data

tensorflow/python/keras/engine/training.py:2319–2565  ·  view source on GitHub ↗

Runs validation checks on input and target data passed by the user. Also standardizes the data to lists of arrays, in order. Also builds and compiles the model on the fly if it is a subclassed model that has never been called before (and thus has no inputs/outputs). This is a pure

(self,
                             x,
                             y=None,
                             sample_weight=None,
                             class_weight=None,
                             batch_size=None,
                             check_steps=False,
                             steps_name='steps',
                             steps=None,
                             validation_split=0,
                             shuffle=False,
                             extract_tensors_from_dataset=False)

Source from the content-addressed store, hash-verified

2317 return x
2318
2319 def _standardize_user_data(self,
2320 x,
2321 y=None,
2322 sample_weight=None,
2323 class_weight=None,
2324 batch_size=None,
2325 check_steps=False,
2326 steps_name='steps',
2327 steps=None,
2328 validation_split=0,
2329 shuffle=False,
2330 extract_tensors_from_dataset=False):
2331 """Runs validation checks on input and target data passed by the user.
2332
2333 Also standardizes the data to lists of arrays, in order.
2334
2335 Also builds and compiles the model on the fly if it is a subclassed model
2336 that has never been called before (and thus has no inputs/outputs).
2337
2338 This is a purely internal method, subject to refactoring at any time.
2339
2340 Args:
2341 x: Input data. It could be:
2342 - A Numpy array (or array-like), or a list of arrays
2343 (in case the model has multiple inputs).
2344 - A TensorFlow tensor, or a list of tensors
2345 (in case the model has multiple inputs).
2346 - A dict mapping input names to the corresponding array/tensors,
2347 if the model has named inputs.
2348 - A `tf.data` dataset.
2349 y: Target data. Like the input data `x`,
2350 it could be either Numpy array(s) or TensorFlow tensor(s).
2351 It should be consistent with `x` (you cannot have Numpy inputs and
2352 tensor targets, or inversely). If `x` is a dataset, `y` should not be
2353 specified (since targets will be obtained from the iterator).
2354 sample_weight: An optional sample-weight array passed by the user to
2355 weight the importance of each sample in `x`.
2356 class_weight: An optional class-weight array by the user to
2357 weight the importance of samples in `x` based on the class they belong
2358 to, as conveyed by `y`. If both `sample_weight` and `class_weight` are
2359 provided, the weights are multiplied.
2360 batch_size: Integer batch size. If provided, it is used to run additional
2361 validation checks on stateful models.
2362 check_steps: boolean, True if we want to check for validity of `steps` and
2363 False, otherwise. For example, when we are standardizing one batch of
2364 data for train_on_batch/predict_on_batch/test_on_batch APIs, `steps`
2365 value is not required and we should not check for its validity in these
2366 cases.
2367 steps_name: The public API's parameter name for `steps`.
2368 steps: Integer or `None`. Total number of steps (batches of samples) to
2369 execute.
2370 validation_split: Float between 0 and 1.
2371 Fraction of the training data to be used as validation data.
2372 shuffle: Boolean whether to shuffle the training data before each epoch.
2373 extract_tensors_from_dataset: Boolean. When `x` is a dataset instance,
2374 this indicates whether to extract actual tensors from the dataset or
2375 instead output the dataset instance itself.
2376 Set to True when calling from `train_on_batch`/etc.

Callers 15

train_on_batchMethod · 0.95
test_on_batchMethod · 0.95
predict_on_batchMethod · 0.95
_pipeline_fitMethod · 0.80
_prepare_feed_valuesFunction · 0.80
fitMethod · 0.80
evaluateMethod · 0.80
predictMethod · 0.80
fitMethod · 0.80

Calls 8

_compile_from_inputsMethod · 0.95
anyFunction · 0.85
allFunction · 0.85
_is_symbolic_tensorFunction · 0.70
flattenMethod · 0.45
appendMethod · 0.45

Tested by 3

test_on_batchMethod · 0.76
test_on_batchFunction · 0.64