コード例 #1
0
ファイル: Model.cs プロジェクト: MyCaffe/MyCaffe-Samples
        /// <summary>
        /// Load and return the solver used with the MNIST LeNet input model.
        /// </summary>
        /// <returns>The SolverParameter is returned.</returns>
        public SolverParameter CreateMnistSolver()
        {
            string   str   = System.Text.Encoding.Default.GetString(Properties.Resources.lenet_solver);
            RawProto proto = RawProto.Parse(str);

            return(SolverParameter.FromProto(proto));
        }
コード例 #2
0
        /// <summary>
        /// Set the solver testing interval.
        /// </summary>
        /// <param name="strSolver">Specifies the solver parameter.</param>
        /// <returns>The solver description is returned.</returns>
        private string fixup_solver(string strSolver, int nInterval)
        {
            RawProto        proto        = RawProto.Parse(strSolver);
            SolverParameter solver_param = SolverParameter.FromProto(proto);

            // Set the testining interval during training.
            solver_param.test_interval       = nInterval;
            solver_param.test_initialization = false;

            return(solver_param.ToProto("root").ToString());
        }
コード例 #3
0
        public void TestCreateSolver()
        {
            ModelBuilder builder = create();

            SolverParameter solverParam = builder.CreateSolver();
            RawProto        proto       = solverParam.ToProto("root");
            string          strSolver   = proto.ToString();

            RawProto        proto2       = RawProto.Parse(strSolver);
            SolverParameter solverParam2 = SolverParameter.FromProto(proto2);

            m_log.CHECK(solverParam2.Compare(solverParam), "The two solver parameters should be the same!");
        }