vaeac_extend_batch: Extends Incomplete Batches by Sampling Extra Data from...

View source: R/approach_vaeac_torch_modules.R

vaeac_extend_batchR Documentation

Extends Incomplete Batches by Sampling Extra Data from Dataloader

Description

If the height of the batch is less than batch_size, this function extends the batch with data from the torch::dataloader() until the batch reaches the required size. Note that batch is a tensor.

Usage

vaeac_extend_batch(batch, dataloader, batch_size)

Arguments

batch

The batch we want to check if has the right size, and if not extend it until it has the right size.

dataloader

A torch::dataloader() object from which we can create an iterator object and load data to extend the batch.

batch_size

Integer. The number of samples to include in each batch.

Value

Returns the extended batch with the correct batch_size.

Author(s)

Lars Henry Berge Olsen


NorskRegnesentral/shapr documentation built on April 19, 2024, 1:19 p.m.