Example #1
0
 public void ConnectForward(Can[] _dL_dnextX, Can[] _dnextX_dOutput)
 {
     int out_dim = dL_dnextX.Length;
     if (_dL_dnextX.Length != out_dim || _dnextX_dOutput.Length != out_dim)
         throw new Exception("Neural.CellSet.Cell.ConnectForward: wrong output dimension");
     for (int i = 0; i < out_dim; i++)
     {
         dL_dnextX[i] = _dL_dnextX[i];
         dnextX_dOutput[i] = _dnextX_dOutput[i];
     }
 }
Example #2
0
            public void Init(int input_dim, CellType typ, int out_dim)
            {
                if (input_dim < 1 || out_dim < 1)
                    throw (new System.Exception("Neural.CellSet.Cell.Init: wrong dimension"));
                switch (typ)
                {
                    case CellType.Linear:
                        Function = new Delegate11(FunctionLinear);
                        Derivative = new Delegate12(DerivativeLinear);
                        break;
                    case CellType.Expotential:
                        Function = new Delegate11(FunctionExpotential);
                        Derivative = new Delegate12(DerivativeExpotential);
                        break;
                    case CellType.Arcustangent:
                        Function = new Delegate11(FunctionArcustangent);
                        Derivative = new Delegate12(DerivativeArcustangent);
                        break;
                    default:
                        throw new System.Exception("Neural.CellSet.Cell.Init: wrong cell type");
                }
                Type = typ;

                Input = new Can[input_dim];
                Output = new Can();
                Weight = new Can[input_dim];
                dL_dX = new Can();
                dL_dWeight = new Can[input_dim];
                for (int i = 0; i < input_dim; i++)
                {
                    Weight[i] = new Can();
                    dL_dWeight[i] = new Can();
                }

                dL_dnextX = new Can[out_dim];
                dnextX_dOutput = new Can[out_dim];
            }
Example #3
0
 public void ConnectBackward(Can[] inputs)
 {
     int in_dim = Input.Length;
     if (in_dim != inputs.Length)
         throw new Exception("Neural.CellSet.Cell.ConnectBackward: wrong input dimension");
     for (int i = 0; i < in_dim; i++)
         Input[i] = inputs[i];
 }