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; } } }
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; } }
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; } }
public NetComponentChain() { _head = null; _tail = null; }