Skip to contents

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

Usage

unpack_x_y_sample_weight(data)

Arguments

data

A list of the form (x), (x, y), or (x, y, sample_weight).

Value

The unpacked list, with NULLs for y and sample_weight if they are not provided.

Usage

Standalone usage:

features_batch <- op_ones(c(10, 5))
labels_batch <- op_zeros(c(10, 5))
data <- list(features_batch, labels_batch)
# `y` and `sample_weight` will default to `NULL` if not provided.
c(x, y, sample_weight) %<-% unpack_x_y_sample_weight(data)