示例#1
0
        static void Main(string[] args)
        {
            SuperchargedArray.Device.SetBackend(SuperchargedArray.Backend.Interop.BackendType.CUDA);
            var x = SuperArray.Create(new float[, ] {
                { 1, 2 }, { 3, 4 }
            });
            //var y = AFArray.Exp(x) / (Data.Constant<float>(1, x.Dimensions) + AFArray.Exp(x));
            var y = Ops.Sqrt(x);

            y.Print();
            var(dx, dy) = Ops.Grad(y);
            dx.Print();

            XOR.Run();

            Console.ReadLine();
        }
示例#2
0
        public static void RunArraySimplified()
        {
            //Create an array with values
            SuperArray a = SuperArray.Create(new float[, ] {
                { 1, 2 }, { 3, 4 }, { 5, 6 }
            });

            //Create a array with constant value 2
            SuperArray b = SuperArray.Constant <float>(2, (3, 2));

            var sum = a + b;
            //Perform Math operation on the array: 2A + Log(B) + Exp(A)
            var r = 2 * a - Ops.Log(b) + Ops.Exp(a);

            //Print the Array
            r.Print();
        }
 public virtual void Load(float[,,,] data)
 {
     variable = SuperArray.Create(data);
 }