override public Dictionary <string, Matrix> CalcGradient(Vector p_error = null) { NeuralGroup core = _groups["core"]; core.CalcDerivs(false); if (p_error == null) { core.CalcDelta(false); } else { core.Delta = Vector.HadamardProduct(core.Derivs, p_error); } foreach (Connection c in core.GetInConnections()) { if (c.Trainable) { c.CalcGradient(false); _gradients[c.Id] = c.Gradient; } } return(_gradients); }
override public Dictionary <string, Tensor> CalcGradientT(Tensor p_error = null) { NeuralGroup core = _groups["core"]; core.CalcDerivs(true); if (p_error == null) { core.CalcDelta(true); } else { core.DeltaT = core.DerivsT * p_error; } foreach (Connection c in core.GetInConnections()) { if (c.Trainable) { c.CalcGradient(true); _gradients_t[c.Id] = c.GradientT; } } return(_gradients_t); }