std1.0.0-beta-7 SafeC docs

std :: ml::tensor_half

Function std::half_grads_accumulate

#include <std/ml/tensor_half.h> source ยท definition

generic<E> int half_grads_accumulate(
    const &Vec<&DenseTensor<E>> grads,
    &Vec<&FloatTensor> params,
    float invScale,
)

params[i].grad += grads[i] * invScale (allocating the gradient if needed). Returns 1 if every resulting gradient value is finite -- the LossScaler::update argument -- and 0 on an overflow or a size mismatch.