Exemple #1
0
        public CudaProvider(string cudaKernelPath, bool stochastic = true)
        {
            _stochastic = stochastic;
            _cuda       = new CudaContext();
            _kernel     = new KernelModule(_cuda, cudaKernelPath);
            _blas       = new CudaBlas(AtomicsMode.Allowed);

            _pointwiseMultiply = _kernel.LoadFunction("PointwiseMultiply");
            _addInPlace        = _kernel.LoadFunction("AddInPlace");
            _subtractInPlace   = _kernel.LoadFunction("SubtractInPlace");
            _addToEachRow      = _kernel.LoadFunction("AddToEachRow");
            _addToEachColumn   = _kernel.LoadFunction("AddToEachColumn");
            _tanh              = _kernel.LoadFunction("TanH");
            _tanhDerivative    = _kernel.LoadFunction("TanHDerivative");
            _sigmoid           = _kernel.LoadFunction("Sigmoid");
            _sigmoidDerivative = _kernel.LoadFunction("SigmoidDerivative");
            _sumRows           = _kernel.LoadFunction("SumRows");
            _relu              = _kernel.LoadFunction("RELU");
            _reluDerivative    = _kernel.LoadFunction("RELUDerivative");
            _memClear          = _kernel.LoadFunction("MemClear");
            _sparseLoad        = _kernel.LoadFunction("SparseLoad");
            _sumColumns        = _kernel.LoadFunction("SumColumns");
            _pointwiseDivide   = _kernel.LoadFunction("PointwiseDivide");
            _sqrt              = _kernel.LoadFunction("Sqrt");
            _memCopy           = _kernel.LoadFunction("MemCopy");
            _findMinAndMax     = _kernel.LoadFunction("FindMinAndMax");
            _findSum           = _kernel.LoadFunction("FindSum");
            _findStdDev        = _kernel.LoadFunction("FindStdDev");
            _constrain         = _kernel.LoadFunction("Constrain");
            _pow                    = _kernel.LoadFunction("Pow");
            _diagonal               = _kernel.LoadFunction("Diagonal");
            _l1Regularisation       = _kernel.LoadFunction("L1Regularisation");
            _leakyRelu              = _kernel.LoadFunction("LeakyRELU");
            _leakyReluDerivative    = _kernel.LoadFunction("LeakyRELUDerivative");
            _pointwiseDivideRows    = _kernel.LoadFunction("PointwiseDivideRows");
            _pointwiseDivideColumns = _kernel.LoadFunction("PointwiseDivideColumns");
            _splitRows              = _kernel.LoadFunction("SplitRows");
            _splitColumns           = _kernel.LoadFunction("SplitColumns");
            _concatRows             = _kernel.LoadFunction("ConcatRows");
            _concatColumns          = _kernel.LoadFunction("ConcatColumns");
            _euclideanDistance      = _kernel.LoadFunction("EuclideanDistance");
            _manhattanDistance      = _kernel.LoadFunction("ManhattanDistance");
            _abs                    = _kernel.LoadFunction("Abs");
            _normalise              = _kernel.LoadFunction("Normalise");
            _softmaxVector          = _kernel.LoadFunction("SoftmaxVector");
            _multiEuclidean         = _kernel.LoadFunction("MultiEuclideanDistance");
            _multiManhattan         = _kernel.LoadFunction("MultiManhattanDistance");
            _log                    = _kernel.LoadFunction("Log");
            _sigmoidVector          = _kernel.LoadFunction("SigmoidVector");
            _vectorAdd              = _kernel.LoadFunction("VectorAdd");
            _vectorCopyRandom       = _kernel.LoadFunction("VectorCopyRandom");
            _copyToMatrix           = _kernel.LoadFunction("CopyToMatrix");
            _vectorSplit            = _kernel.LoadFunction("VectorSplit");
            _tensorConvertToVector  = _kernel.LoadFunction("TensorConvertToVector");
            _tensorConvertToMatrix  = _kernel.LoadFunction("TensorConvertToMatrix");
            _tensorAddPadding       = _kernel.LoadFunction("TensorAddPadding");
            _tensorIm2Col           = _kernel.LoadFunction("TensorIm2Col");
        }