Ejemplo n.º 1
0
        protected override void Initialize()
        {
            base.Initialize();

            // Create the output and log directories.
            string baselineRootDir = Path.Combine(RootDir, TestDir, "BaselineOutput");

            Contracts.Check(Directory.Exists(baselineRootDir));

            _baselineCommonDir      = Path.Combine(baselineRootDir, "Common");
            _baselineBuildStringDir = Path.Combine(baselineRootDir, BuildString);

            string logDir = Path.Combine(OutDir, _logRootRelPath);

            Directory.CreateDirectory(logDir);

            string logPath = Path.Combine(logDir, FullTestName + LogSuffix);

            LogWriter = OpenWriter(logPath);

            TestLogger = new TestLogger(Output);
            _env       = new ConsoleEnvironment(42, outWriter: LogWriter, errWriter: LogWriter, testWriter: TestLogger)
                         .AddStandardComponents();
            ML      = new MLContext(42);
            ML.Log += LogTestOutput;
            ML.AddStandardComponents();
        }
Ejemplo n.º 2
0
        protected override void Initialize()
        {
            base.Initialize();

            _ml = new MLContext(42);
            _ml.AddStandardComponents();
        }
        public void NewTest()
        {
            var ml = new MLContext();

            ml.AddStandardComponents();
            var classes = Utils.MarshalInvoke(ml.ComponentCatalog.FindLoadableClasses <int>, typeof(SignatureCalibrator));

            foreach (var cls in classes)
            {
                var factory    = CmdParser.CreateComponentFactory(typeof(IComponentFactory <ICalibratorTrainer>), typeof(SignatureCalibrator), cls.LoadNames[0]);
                var calibrator = ((IComponentFactory <ICalibratorTrainer>)factory).CreateComponent(ml);
            }
            var components = ml.ComponentCatalog.GetAllComponents(typeof(ICalibratorTrainerFactory));

            foreach (var component in components)
            {
                var factory    = CmdParser.CreateComponentFactory(typeof(IComponentFactory <ICalibratorTrainer>), typeof(SignatureCalibrator), component.Aliases[0]);
                var calibrator = ((IComponentFactory <ICalibratorTrainer>)factory).CreateComponent(ml);
            }
        }