Skip to contents

Largest power of two in {32, 64, 128, 256, 512} not exceeding n_train / steps_per_epoch_target (and memory_limit if supplied), flooring at min(32, n_train) when nothing is feasible.

Usage

morie_geron_batch_size_heuristic(
  n_train,
  steps_per_epoch_target = 10,
  memory_limit = NULL
)

Arguments

n_train

Training-set size, >= 1.

steps_per_epoch_target

Minimum updates per epoch, >= 1.

memory_limit

Optional hard cap.

Value

List with batch_size, steps_per_epoch, candidates, cap.

Examples

morie_geron_batch_size_heuristic(n_train = 5L)
#> $batch_size
#> [1] 5
#> 
#> $steps_per_epoch
#> [1] 1
#> 
#> $candidates
#> [1]  32  64 128 256 512
#> 
#> $cap
#> [1] 0.5
#> 
#> $clamped
#> [1] TRUE
#> 
#> $estimate
#> [1] 5
#> 
#> $n
#> [1] 5
#> 
#> $method
#> [1] "Batch size heuristic (largest power of two in [32, 512] under the step-count cap)"
#>