source/train/XWorkerUpdate.cpp
void XWorkerUpdate::UpdateParameter(XTensorKeeper * paramKeeper, XOptimizer * optimizer)
{

    CheckNTErrors(paramKeeper->flag == PARAM_STATE_COLLECTED, "The state of the parameter is wrong!");

    XTensor * param = paramKeeper->tensor;
    XTensor * grad = paramKeeper->grad;

    CheckNTErrors(grad != NULL, "No gradient!");

    /* update the parameter */
    optimizer->UpdateParam(param, grad);

    /* set the flag */
    paramKeeper->flag = PARAM_STATE_UPDATED;
}
/* 
update a parameter of a model 
>> paramKeeper -  the parameter keeper
>> optimizer - the optimizer
*/
update a parameter of a model
>> paramKeeper -  the parameter keeper
>> optimizer - the optimizer
update a parameter of a model >> paramKeeper - the parameter keeper >> optimizer - the optimizer
void XWorkerUpdate::UpdateParameter(XTensorKeeper * paramKeeper, XOptimizer * optimizer)
{
    CheckNTErrors(paramKeeper->flag == PARAM_STATE_COLLECTED, "The state of the parameter is wrong!");
    XTensor * param = paramKeeper->tensor;
    XTensor * grad = paramKeeper->grad;
    CheckNTErrors(grad != NULL, "No gradient!");
    optimizer->UpdateParam(param, grad);
    paramKeeper->flag = PARAM_STATE_UPDATED;
}
void XWorkerUpdate :: UpdateParameter ( XTensorKeeper * paramKeeper , XOptimizer * optimizer ) { CheckNTErrors ( paramKeeper -> flag == PARAM_STATE_COLLECTED , " " ) ; XTensor * param = paramKeeper -> tensor ; XTensor * grad = paramKeeper -> grad ; CheckNTErrors ( grad != NULL , " " ) ; optimizer -> UpdateParam ( param , grad ) ; paramKeeper -> flag = PARAM_STATE_UPDATED ; }
update a parameter of a model
>> paramKeeper -  the parameter keeper
>> optimizer - the optimizer
update a parameter of a model >> paramKeeper - the parameter keeper >> optimizer - the optimizer
/* update the parameter */ /* set the flag */