Exemplo n.º 1
0
        public void BackPropagate(VectorBatch outputgradients)
        {
            VectorBatch  currentGradient = outputgradients;
            NetComponent currentComponent;

            _networkComponentNode node = _tail;
            {
                while (node != null)
                {
                    currentComponent = node.Component;
                    if (node.IsTrainable)
                    {
                        (currentComponent as TrainableComponent).BackPropagate(currentGradient);
                    }

                    currentGradient = currentComponent.InputGradient(currentGradient);
                    node            = node.Previous;
                }
            }
        }
Exemplo n.º 2
0
        protected void _addComponent(NetComponent componentToAdd, bool istrainable)
        {
            if (_componentHasWrongSize(componentToAdd))
            {
                throw new ArgumentException("Attempt to add with inputs size differnt from output size of the last existing Layer");
            }

            _networkComponentNode nodeToAdd = new _networkComponentNode(componentToAdd, istrainable);

            if (_head == null)
            {
                _head = nodeToAdd;
                _tail = _head;
            }
            else
            {
                _tail.Next          = nodeToAdd;
                _tail.Next.Previous = _tail;
                _tail = _tail.Next;
            }
        }
Exemplo n.º 3
0
        public virtual void Add(NetworkComponent componentToAdd)
        {
            if (_componentHasWrongSize(componentToAdd))
            {
                throw new ArgumentException("Attempt to add with inputs size differnt from output size of the last existing Layer");
            }

            _networkComponentNode nodeToAdd = new _networkComponentNode(componentToAdd);

            if (_head == null)
            {
                _head = nodeToAdd;
                _tail = _head;
            }
            else
            {
                _tail.Next          = nodeToAdd;
                _tail.Next.Previous = _tail;
                _tail = _tail.Next;
            }
        }
Exemplo n.º 4
0
 public NetComponentChain()
 {
     _head = null;
     _tail = null;
 }