public override void AggragateBatch(DNNRun dnnData) { int ParNum = 0; for (int i = 0; i < dnnData.neurallinks.Count; i++) { int mnum = dnnData.neurallinks[i].NeuralLinkModel.Neural_In.Number * dnnData.neurallinks[i].NeuralLinkModel.N_Winsize * dnnData.neurallinks[i].NeuralLinkModel.Neural_Out.Number; MathOperatorManager.GlobalInstance.Matrix_Add_OFFSET(grad_list[GradIdx % GradHistory], ParNum, dnnData.neurallinks[i].WeightDeriv, 0, mnum, -1.0f); ParNum += mnum; if (ParameterSetting.UpdateBias) { mnum = dnnData.neurallinks[i].NeuralLinkModel.Neural_Out.Number; MathOperatorManager.GlobalInstance.Matrix_Add_OFFSET(grad_list[GradIdx % GradHistory], ParNum, dnnData.neurallinks[i].BiasDeriv, 0, mnum, -1.0f); ParNum += mnum; } } }
void Init(DNN dnn_query, DNN dnn_doc) { dnn_model_query = new DNNRun(dnn_query); dnn_model_doc = new DNNRun(dnn_doc); Pos_QD_Pair_TOP = new Layer_Output_Deriv_QD_PairTOP(dnn_query, dnn_doc); Neg_QD_Pair_TOP = new Layer_Output_Deriv_QD_PairTOP_Full(dnn_query, dnn_doc, ParameterSetting.NTRIAL); alphaCudaPiece = new CudaPieceFloat(ParameterSetting.BATCH_SIZE * (ParameterSetting.NTRIAL + 1), true, true); distCudaPiece = new CudaPieceFloat(ParameterSetting.BATCH_SIZE * (ParameterSetting.NTRIAL + 1), true, true); GPU_negative_index_Array = new CudaPieceInt(ParameterSetting.NTRIAL * ParameterSetting.BATCH_SIZE, true, true); GPU_Inver_negative_index_Array = new CudaPieceInt(ParameterSetting.NTRIAL * ParameterSetting.BATCH_SIZE, true, true); GPU_Inver_negative_value_Array = new CudaPieceInt(ParameterSetting.NTRIAL * ParameterSetting.BATCH_SIZE, true, true); if (ParameterSetting.PSEUDO_RANDOM) { neg_random = new Random(ParameterSetting.RANDOM_SEED); } }
public virtual void AggragateBatch(DNNRun dnnData) { }