std1.0.0-beta-7 SafeC docs

std :: ml::gpu_rocm

Function std::rocm_mp_sgd

#include <std/ml/gpu_rocm.h> source · definition

int rocm_mp_sgd(
    struct RocmBuf w,
    struct RocmBuf g,
    struct RocmBuf vel,
    struct RocmHalfBuf wHalf,
    float lr,
    float momentum,
    float weightDecay,
    struct RocmBuf skip,
)

Optimizer steps on fp32 master weights w with gradient g, as nn.h's Optimizer::step (OPT_SGD / OPT_MOMENTUM when vel is valid, OPT_ADAM / OPT_ADAMW when decoupled; 'step' is the 1-based step count for the bias correction). The updated weights are also written, rounded, to wHalf when it is valid. Skipped entirely when skip is valid and skip[0] != 0. Pass an invalid buffer (dev == 0) for any optional argument.