/// <summary> /// The SGDSolver constructor. /// </summary> /// <param name="cuda">Specifies the instance of CudaDnn to use.</param> /// <param name="log">Specifies the Log for output.</param> /// <param name="p">Specifies teh SolverParameter.</param> /// <param name="evtCancel">Specifies a CancelEvent used to cancel the current operation (e.g. training, testing) for which the Solver is performing.</param> /// <param name="evtForceSnapshot">Specifies an automatic reset event that causes the Solver to perform a Snapshot when set.</param> /// <param name="evtForceTest">Specifies an automatic reset event that causes teh Solver to run a testing cycle when set.</param> /// <param name="imgDb">Specifies the CaffeImageDatabase.</param> /// <param name="persist">Specifies the peristence used for loading and saving weights.</param> /// <param name="nSolverCount">Specifies the number of Solvers participating in a multi-GPU session.</param> /// <param name="nSolverRank">Specifies the rank of this Solver in a multi-GPU session.</param> /// <param name="shareNet">Optionally, specifies the net to share when creating the training network (default = null, meaning no share net is used).</param> /// <param name="getws">Optionally, specifies the handler for getting the workspace.</param> /// <param name="setws">Optionally, specifies the handler for setting the workspace.</param> public AdaDeltaSolver(CudaDnn <T> cuda, Log log, SolverParameter p, CancelEvent evtCancel, AutoResetEvent evtForceSnapshot, AutoResetEvent evtForceTest, IXImageDatabase imgDb, IXPersist <T> persist, int nSolverCount = 1, int nSolverRank = 0, Net <T> shareNet = null, onGetWorkspace getws = null, onSetWorkspace setws = null) : base(cuda, log, p, evtCancel, evtForceSnapshot, evtForceTest, imgDb, persist, nSolverCount, nSolverRank, shareNet, getws, setws) { AdaDeltaPreSolve(); }
/// <summary> /// The NesterovSolver constructor. /// </summary> /// <param name="cuda">Specifies the instance of CudaDnn to use.</param> /// <param name="log">Specifies the Log for output.</param> /// <param name="p">Specifies teh SolverParameter.</param> /// <param name="evtCancel">Specifies a CancelEvent used to cancel the current operation (e.g. training, testing) for which the Solver is performing.</param> /// <param name="evtForceSnapshot">Specifies an automatic reset event that causes the Solver to perform a Snapshot when set.</param> /// <param name="evtForceTest">Specifies an automatic reset event that causes teh Solver to run a testing cycle when set.</param> /// <param name="imgDb">Specifies the MyCaffeImageDatabase.</param> /// <param name="persist">Specifies the peristence used for loading and saving weights.</param> /// <param name="nSolverCount">Specifies the number of Solvers participating in a multi-GPU session.</param> /// <param name="nSolverRank">Specifies the rank of this Solver in a multi-GPU session.</param> /// <param name="shareNet">Optionally, specifies the net to share when creating the training network (default = null, meaning no share net is used).</param> /// <param name="getws">Optionally, specifies the handler for getting the workspace.</param> /// <param name="setws">Optionally, specifies the handler for setting the workspace.</param> public AdaGradSolver(CudaDnn <T> cuda, Log log, SolverParameter p, CancelEvent evtCancel, AutoResetEvent evtForceSnapshot, AutoResetEvent evtForceTest, IXImageDatabaseBase imgDb, IXPersist <T> persist, int nSolverCount = 1, int nSolverRank = 0, Net <T> shareNet = null, onGetWorkspace getws = null, onSetWorkspace setws = null) : base(cuda, log, p, evtCancel, evtForceSnapshot, evtForceTest, imgDb, persist, nSolverCount, nSolverRank, shareNet, getws, setws) { m_log.CHECK_EQ(0, m_param.momentum, "Momentum cannot be used with AdaGrad."); }
/// <summary> /// The RmsPropSolver constructor. /// </summary> /// <param name="cuda">Specifies the instance of CudaDnn to use.</param> /// <param name="log">Specifies the Log for output.</param> /// <param name="p">Specifies teh SolverParameter.</param> /// <param name="evtCancel">Specifies a CancelEvent used to cancel the current operation (e.g. training, testing) for which the Solver is performing.</param> /// <param name="evtForceSnapshot">Specifies an automatic reset event that causes the Solver to perform a Snapshot when set.</param> /// <param name="evtForceTest">Specifies an automatic reset event that causes teh Solver to run a testing cycle when set.</param> /// <param name="imgDb">Specifies the MyCaffeImageDatabase.</param> /// <param name="persist">Specifies the peristence used for loading and saving weights.</param> /// <param name="nSolverCount">Specifies the number of Solvers participating in a multi-GPU session.</param> /// <param name="nSolverRank">Specifies the rank of this Solver in a multi-GPU session.</param> /// <param name="shareNet">Optionally, specifies the net to share when creating the training network (default = null, meaning no share net is used).</param> /// <param name="getws">Optionally, specifies the handler for getting the workspace.</param> /// <param name="setws">Optionally, specifies the handler for setting the workspace.</param> public RmsPropSolver(CudaDnn <T> cuda, Log log, SolverParameter p, CancelEvent evtCancel, AutoResetEvent evtForceSnapshot, AutoResetEvent evtForceTest, IXImageDatabaseBase imgDb, IXPersist <T> persist, int nSolverCount = 1, int nSolverRank = 0, Net <T> shareNet = null, onGetWorkspace getws = null, onSetWorkspace setws = null) : base(cuda, log, p, evtCancel, evtForceSnapshot, evtForceTest, imgDb, persist, nSolverCount, nSolverRank, shareNet, getws, setws) { m_log.CHECK_EQ(0, m_param.momentum, "Momentum cannot be used with RmsProp."); m_log.CHECK_GE(m_param.rms_decay, 0, "rms_decay should lie between 0 and 1."); m_log.CHECK_LT(m_param.rms_decay, 1, "rms_decay should lie between 0 and 1."); }
/// <summary> /// The LBFGSSolver constructor. /// </summary> /// <param name="cuda">Specifies the instance of CudaDnn to use.</param> /// <param name="log">Specifies the Log for output.</param> /// <param name="p">Specifies teh SolverParameter.</param> /// <param name="evtCancel">Specifies a CancelEvent used to cancel the current operation (e.g. training, testing) for which the Solver is performing.</param> /// <param name="evtForceSnapshot">Specifies an automatic reset event that causes the Solver to perform a Snapshot when set.</param> /// <param name="evtForceTest">Specifies an automatic reset event that causes teh Solver to run a testing cycle when set.</param> /// <param name="imgDb">Specifies the MyCaffeImageDatabase.</param> /// <param name="persist">Specifies the peristence used for loading and saving weights.</param> /// <param name="nSolverCount">Specifies the number of Solvers participating in a multi-GPU session.</param> /// <param name="nSolverRank">Specifies the rank of this Solver in a multi-GPU session.</param> /// <param name="shareNet">Optionally, specifies the net to share when creating the training network (default = null, meaning no share net is used).</param> /// <param name="getws">Optionally, specifies the handler for getting the workspace.</param> /// <param name="setws">Optionally, specifies the handler for setting the workspace.</param> public LBFGSSolver(CudaDnn <T> cuda, Log log, SolverParameter p, CancelEvent evtCancel, AutoResetEvent evtForceSnapshot, AutoResetEvent evtForceTest, IXImageDatabaseBase imgDb, IXPersist <T> persist, int nSolverCount = 1, int nSolverRank = 0, Net <T> shareNet = null, onGetWorkspace getws = null, onSetWorkspace setws = null) : base(cuda, log, p, evtCancel, evtForceSnapshot, evtForceTest, imgDb, persist, nSolverCount, nSolverRank, shareNet, getws, setws) { m_tZero = (T)Convert.ChangeType(0, typeof(T)); m_tOne = (T)Convert.ChangeType(1, typeof(T)); m_tMinusOne = (T)Convert.ChangeType(-1, typeof(T)); PreSolve(); }