internal static LearnerVector AsLearnerVector(IList <Learner> input) { LearnerVector inputVector = new LearnerVector(); foreach (var element in input) { inputVector.Add(element); } return(inputVector); }
/// <summary> /// construct a trainer /// </summary> /// <param name="model">model to train</param> /// <param name="lossFunction">loss function</param> /// <param name="evaluationFunction">evaluation function</param> /// <param name="parameterLearners">parameters to train</param> /// <param name="progressWriters">training updater</param> /// <returns></returns> public static Trainer CreateTrainer(Function model, Function lossFunction, Function evaluationFunction, IList <Learner> parameterLearners, ProgressWriterVector progressWriters = null) { using (LearnerVector learnerVector = Helper.AsLearnerVector(parameterLearners)) if (progressWriters != null) { return(CNTKLib.CreateTrainer(model, lossFunction, evaluationFunction, learnerVector, progressWriters)); } else { return(CNTKLib.CreateTrainer(model, lossFunction, evaluationFunction, learnerVector)); } }