src/modules/convex/mlp_igd.cpp
/**
 * @brief Perform the perliminary aggregation function: Merge transition states
 */
@brief Perform the perliminary aggregation function: Merge transition states
@brief Perform the perliminary aggregation function : Merge transition states
AnyType
mlp_minibatch_merge::run(AnyType &args) {
    MLPMiniBatchState<MutableArrayHandle<double> > stateLeft = args[0];
    MLPMiniBatchState<ArrayHandle<double> > stateRight = args[1];
    if (stateLeft.algo.numRows == 0) { return stateRight; }
    else if (stateRight.algo.numRows == 0) { return stateLeft; }
    MLPMiniBatchAlgorithm::mergeInPlace(stateLeft, stateRight);
    stateLeft.algo.numRows += stateRight.algo.numRows;
    stateLeft.algo.loss += stateRight.algo.loss;
    return stateLeft;
}
AnyType mlp_minibatch_merge :: run ( AnyType & args ) { MLPMiniBatchState < MutableArrayHandle < double > > stateLeft = args [ 0 ] ; MLPMiniBatchState < ArrayHandle < double > > stateRight = args [ 1 ] ; if ( stateLeft . algo . numRows == 0 ) { return stateRight ; } else if ( stateRight . algo . numRows == 0 ) { return stateLeft ; } MLPMiniBatchAlgorithm :: mergeInPlace ( stateLeft , stateRight ) ; stateLeft . algo . numRows += stateRight . algo . numRows ; stateLeft . algo . loss += stateRight . algo . loss ; return stateLeft ; }
@brief Perform the perliminary aggregation function: Merge transition states
@brief Perform the perliminary aggregation function : Merge transition states
// The following numRows update, cannot be put above, because the model // averaging depends on their original values