nnf_mixup {luz} | R Documentation |
Mixup logic
Description
Logic underlying luz_callback_mixup()
.
Usage
nnf_mixup(x, y, weight)
Arguments
x |
an input batch |
y |
a target batch |
weight |
weighting coefficient to be used by |
Details
Based on the passed-in input and target batches, as well as applicable mixing weights, we return new tensors intended to replace the current batch. The new input batch is a weighted linear combination of input batch items, while the new target batch bundles the original targets, as well as the mixing weights, in a nested list.
Value
A list
of:
-
x
, the new, mixed-up input batch -
y
, alist
of:-
ys
, alist
of:-
y1
, the original targety1
-
y2
, the mixed-in targety2
-
-
weight
, the mixing weights
-
See Also
Examples
if (torch::torch_is_installed()) {
batch_x <- torch::torch_randn(c(10, 768))
batch_y <- torch::torch_randn(10)
weight <- torch::torch_tensor(rep(0.9, 10))$view(c(10, 1))
nnf_mixup(batch_x, batch_y, weight)
}
[Package luz version 0.4.0 Index]