source/sample/transformer/submodel/GLU.cpp
void GLU::InitModel(NMTConfig& config, bool isEnc)
{
    SetTrainingFlag(config.training.isTraining);
    devID = config.common.devID;

    float minmax = 0;

    inSize = isEnc ? config.model.encEmbDim : config.model.decEmbDim;
    outSize = isEnc ? config.model.encEmbDim : config.model.decEmbDim;

    InitTensor2D(&w1, hSize, outSize, X_FLOAT, devID);
    InitTensor1D(&b1, outSize, X_FLOAT, devID);

    InitTensor2D(&w2, hSize, outSize, X_FLOAT, devID);
    InitTensor1D(&b2, outSize, X_FLOAT, devID);
}
/*
initialize the model
>> config - configurations of the model
>> isEnc - indicates whether it is a encoder module
*/
initialize the model
>> config - configurations of the model
>> isEnc - indicates whether it is a encoder module
initialize the model >> config - configurations of the model >> isEnc - indicates whether it is a encoder module
void GLU::InitModel(NMTConfig& config, bool isEnc)
{
    SetTrainingFlag(config.training.isTraining);
    devID = config.common.devID;
    float minmax = 0;
    inSize = isEnc ? config.model.encEmbDim : config.model.decEmbDim;
    outSize = isEnc ? config.model.encEmbDim : config.model.decEmbDim;
    InitTensor2D(&w1, hSize, outSize, X_FLOAT, devID);
    InitTensor1D(&b1, outSize, X_FLOAT, devID);
    InitTensor2D(&w2, hSize, outSize, X_FLOAT, devID);
    InitTensor1D(&b2, outSize, X_FLOAT, devID);
}
void GLU :: InitModel ( NMTConfig & config , bool isEnc ) { SetTrainingFlag ( config . training . isTraining ) ; devID = config . common . devID ; float minmax = 0 ; inSize = isEnc ? config . model . encEmbDim : config . model . decEmbDim ; outSize = isEnc ? config . model . encEmbDim : config . model . decEmbDim ; InitTensor2D ( & w1 , hSize , outSize , X_FLOAT , devID ) ; InitTensor1D ( & b1 , outSize , X_FLOAT , devID ) ; InitTensor2D ( & w2 , hSize , outSize , X_FLOAT , devID ) ; InitTensor1D ( & b2 , outSize , X_FLOAT , devID ) ; }
initialize the model
>> config - configurations of the model
>> isEnc - indicates whether it is a encoder module
initialize the model >> config - configurations of the model >> isEnc - indicates whether it is a encoder module