예제 #1
0
        private static void TestDense()
        {
            Tensor tensor = Tensor.FromArray(Global.Device, new float[] { -1, 2, 3, -4, 5, 6, 7, -8, 9 });

            tensor = tensor.Reshape(3, -1);
            Dense d = new Dense(6, ActivationType.Linear, new Ones(), null, null, true, new Ones());

            d.Forward(Variable.Create(tensor));
            d.Output.Print();

            d.Backward(d.Output);
            d.Input.Grad.Print();
            d.Params["w"].Grad.Print();
            d.Params["b"].Grad.Print();
        }