Esempio n. 1
0
        public void AddLayer(Vector[] arvWeight, Scalar[] arsBias, Tnsf tnsf)
        {
            int cPcpndef = arvWeight.Length;
            int cInputs  = arvWeight[0].Count;

            if (cPcpndef != arsBias.Length)
            {
                throw new ArgumentException($"{nameof(arvWeight)} ({cPcpndef}) and {nameof(arsBias)} ({arsBias.Length}) are differnt lengths");
            }

            if (lslayrdef.Count > 0 && cInputs != lslayrdef[lslayrdef.Count - 1].CPcpn)
            {
                throw new ArgumentException($"Number of inputs ({cInputs}) does not match previous layer's number of outputs ({lslayrdef[lslayrdef.Count - 1].CPcpn})");
            }

            Pcpndef[] arpcpndef = new Pcpndef[cPcpndef];
            for (int i = 0; i < cPcpndef; i++)
            {
                if (cInputs != arvWeight[i].Count)
                {
                    throw new ArgumentException($"Weights vectors differ in rank at [0] and [{i}]");
                }

                arpcpndef[i] = new Pcpndef(arvWeight[i], arsBias[i]);
            }

            lslayrdef.Add(new Layrdef(arpcpndef, tnsf));
        }
Esempio n. 2
0
        public Layr(Pcpn[] arpcpn, Tnsf tnsf)
        {
            this.tnsf   = tnsf;
            this.arpcpn = arpcpn;

            vOutput      = new Vector(Count);
            vPreoutput   = new Vector(Count);
            vSensitivity = new Vector(Count);
            vAdjWeight   = new Vector(arpcpn[0].cInput);
        }
Esempio n. 3
0
 public Layrdef(Pcpndef[] arpcpndef, Tnsf tnsf)
 {
     this.arpcpndef = arpcpndef;
     this.tnsf      = tnsf;
 }