Spec-Zone.ru › TensorFlow

tf.keras.utils.unpack_x_y_sample_weight

Unpacks user-provided data tuple.

tf.keras.utils.unpack_x_y_sample_weight(
    data
)

Used in the notebooks

Used in the guide
  • Integrating MinDiff without MinDiffModel
  • Creating a custom Counterfactual Logit Pairing Dataset

This is a convenience utility to be used when overriding Model.train_step, Model.test_step, or Model.predict_step. This utility makes it easy to support data of the form (x,), (x, y), or (x, y, sample_weight).

Example:

features_batch = ops.ones((10, 5))
labels_batch = ops.zeros((10, 5))
data = (features_batch, labels_batch)
# `y` and `sample_weight` will default to `None` if not provided.
x, y, sample_weight = unpack_x_y_sample_weight(data)
sample_weight is None
True
Args
data A tuple of the form (x,), (x, y), or (x, y, sample_weight).
Returns
The unpacked tuple, with Nones for y and sample_weight if they are not provided.

© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/keras/utils/unpack_x_y_sample_weight

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API