ggml_opt_init_for_fit_multi: Initialize a multi-output optimizer context for an R-side...

View source: R/optimizer.R

ggml_opt_init_for_fit_multiR Documentation

Initialize a multi-output optimizer context for an R-side epoch loop

Description

Multi-output counterpart of ggml_opt_init_for_fit(). Returns the same opt_ctx/lr_ud pair, so ggml_opt_set_lr() and hence LR schedulers work identically; in addition it records each head's loss type, weight and label offset, which ggml_opt_fit_multi() would otherwise set internally.

Usage

ggml_opt_init_for_fit_multi(
  sched,
  loss_types,
  loss_weights,
  labels_offs,
  optimizer = ggml_opt_optimizer_type_adamw(),
  opt_period = 1L,
  ctx_compute = NULL,
  inputs = NULL,
  outputs = NULL,
  weight_decay = 0
)

Arguments

sched

Backend scheduler

loss_types

Integer vector of loss type constants, one per head

loss_weights

Numeric vector of head weights, one per head

labels_offs

Numeric vector of 0-based label offsets, one per head

optimizer

Optimizer type constant

opt_period

Gradient accumulation period

ctx_compute

Compute context holding the model graph

inputs

Input tensor

outputs

List of output tensors, one per head

weight_decay

As for ggml_opt_init_for_fit().

Value

List with elements 'opt_ctx' and 'lr_ud'

See Also

Other optimization: ggml_fit_opt(), ggml_fit_opt_gen(), ggml_fit_opt_multi(), ggml_opt_alloc(), ggml_opt_context_optimizer_type(), ggml_opt_dataset_data(), ggml_opt_dataset_free(), ggml_opt_dataset_get_batch(), ggml_opt_dataset_get_batch_head(), ggml_opt_dataset_init(), ggml_opt_dataset_labels(), ggml_opt_dataset_ndata(), ggml_opt_dataset_shuffle(), ggml_opt_dataset_weights(), ggml_opt_default_params(), ggml_opt_epoch(), ggml_opt_eval(), ggml_opt_fit(), ggml_opt_fit_multi(), ggml_opt_free(), ggml_opt_get_lr(), ggml_opt_grad_acc(), ggml_opt_init(), ggml_opt_init_for_fit(), ggml_opt_inputs(), ggml_opt_labels(), ggml_opt_loss(), ggml_opt_loss_i(), ggml_opt_loss_type_binary_cross_entropy(), ggml_opt_loss_type_cross_entropy(), ggml_opt_loss_type_huber(), ggml_opt_loss_type_mae(), ggml_opt_loss_type_mean(), ggml_opt_loss_type_mse(), ggml_opt_loss_type_sum(), ggml_opt_loss_type_weighted_mse(), ggml_opt_n_loss(), ggml_opt_ncorrect(), ggml_opt_optimizer_name(), ggml_opt_optimizer_type_adamw(), ggml_opt_optimizer_type_sgd(), ggml_opt_outputs(), ggml_opt_outputs_i(), ggml_opt_pred(), ggml_opt_prepare_alloc(), ggml_opt_reset(), ggml_opt_result_accuracy(), ggml_opt_result_free(), ggml_opt_result_init(), ggml_opt_result_loss(), ggml_opt_result_loss_i(), ggml_opt_result_n_loss(), ggml_opt_result_ndata(), ggml_opt_result_pred(), ggml_opt_result_reset(), ggml_opt_set_lr(), ggml_opt_static_graphs(), ggml_snapshot_free(), ggml_trainer()


ggmlR documentation built on Oct. 23, 2026, 1:07 a.m.