示例#1
0
        public static void InitProvider()
        {
            var path    = ConfigurationManager.AppSettings["mkl:Path"];
            var threads = int.Parse(ConfigurationManager.AppSettings["mkl:Threads"] ?? "-1");

            StartProvider.LaunchMklRt(threads, path);
        }
示例#2
0
        public void Setup()
        {
            // Launching mkl for NumNet (path might need to be change)
            var path = "C:/data/dlls/mkl";

            StartProvider.LaunchMklRt(1, path);

            var m     = NN.Random.Normal(0f, 0.1f, Vocab, N);
            var vocab = (from i in Enumerable.Range(0, Vocab)
                         select i.ToString()).ToArray();

            _w2v = new Word2Vec(vocab, m);

            int batch = 50;

            vector_test = NN.Random.Normal(0, 0.1f, N, 1);
            matrix_test = NN.Random.Normal(0, 0.1f, N, batch);

            bestd_v    = new float[1][];
            bestw_v    = new int[1][];
            bestd_v[0] = new float[Neighbors];
            bestw_v[0] = new int[Neighbors];
            bestd_m    = new float[batch][];
            bestw_m    = new int[batch][];
            for (int i = 0; i < batch; i++)
            {
                bestd_m[i] = new float[Neighbors];
                bestw_m[i] = new int[Neighbors];
            }
        }
示例#3
0
        public static void InitProvider(TestContext context)
        {
#if !NO_MKL
            var path = ConfigurationManager.AppSettings["mkl:Path"];
            if (path == null)
            {
                Blas.Provider = new DefaultBlas();
            }
            else
            {
                var threads     = int.Parse(ConfigurationManager.AppSettings["mkl:Threads"]);
                var initialized = false;
                var failed      = 0;
                var maxFailures = 5;
                while (!initialized && failed < maxFailures)
                {
                    try
                    {
                        StartProvider.LaunchMklRt(threads, path);
                        initialized = true;
                    }
                    catch (NotSupportedException)
                    {
                        ++failed;
                    }
                }
            }
#endif
        }
示例#4
0
        public void Setup()
        {
            // Launching mkl for NumNet (path might need to be change)
            var path = "C:/data/dlls/mkl";

            StartProvider.LaunchMklRt(1, path);

            // Creating NumPy for NumSharp (deprecated)
            //np = new NumPy();
        }
示例#5
0
        public static void InitProvider(TestContext context)
        {
            var path    = ConfigurationManager.AppSettings["mkl:Path"];
            var threads = int.Parse(ConfigurationManager.AppSettings["mkl:Threads"] ?? "-1");

            if (!Directory.Exists(path))
            {
                throw new DirectoryNotFoundException($"The MKL libs directory '{path}' was not found. Check appSetting 'mkl:Path'.");
            }

            StartProvider.LaunchMklRt(threads, path);
        }
示例#6
0
        public void Setup()
        {
            // Launching mkl for NumNet (path might need to be change)
            var path = "C:/data/dlls/mkl";

            StartProvider.LaunchMklRt(1, path);
            //var np = new NumPy(); deprecated

            _numnet_3d   = NN.Random.Normal(0f, 1f, 10, 8, 12);
            _numsharp_3d = np.random.normal(0f, 1f, 10, 8, 12);

            _numnet_2d   = NN.Random.Normal(-1f, 0.4f, 50, 20);
            _numsharp_2d = np.random.normal(-1f, 0.4f, 50, 20);
        }
示例#7
0
        public void Setup()
        {
            // Launching mkl for NumNet (path might need to be change)
            var path = "C:/data/dlls/mkl";

            StartProvider.LaunchMklRt(1, path);

            numnet_1      = NN.Random.Normal(0, 1, N, N);
            numnet_2      = NN.Random.Normal(0, 1, N, N);
            numnet_flat_1 = NN.Random.Normal(0, 1, N * N);
            numnet_flat_2 = NN.Random.Normal(0, 1, N * N);

            //np = new NumPy();
            numsharp_1      = np.random.normal(0, 1, N, N).reshape(new Shape(N, N)); // need reshaping cause there's a bug in 'np.random.normal'
            numsharp_2      = np.random.normal(0, 1, N, N).reshape(new Shape(N, N));
            numsharp_flat_1 = np.random.normal(0, 1, N * N);
            numsharp_flat_2 = np.random.normal(0, 1, N * N);
        }