View source: R/callbacks-mixup.R
| nnf_mixup | R Documentation |
Logic underlying luz_callback_mixup().
nnf_mixup(x, y, weight)
x |
an input batch |
y |
a target batch |
weight |
weighting coefficient to be used by |
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.
A list of:
x, the new, mixed-up input batch
y, a list of:
ys, a list of:
y1, the original target y1
y2, the mixed-in target y2
weight, the mixing weights
luz_callback_mixup()
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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.