anchor.diff:          (n-inputs (flt (n-inputs-in-batch trainer)))
           (momentum (momentum trainer))
           (weight-decay (weight-decay trainer))
  -        #+nil
           (weight-penalty (weight-penalty trainer)))
       (declare (type flt learning-rate n-inputs momentum
                      weight-decay #+nil weight-penalty))
       (mgl-mat:scal! momentum weight-deltas)
  -    (mgl-mat:axpy! (flt (/ n-inputs)) accumulator weight-deltas)
  +    (mgl-mat:axpy! (/ n-inputs) accumulator weight-deltas)
       ;; FIXME: WEIGHT-PENALTY
       #+nil
       (unless (zerop weight-penalty)
  
positive.code:   n-inputs segment-set
    (learning-rate (learning-rate trainer) "~,5E")
    (momentum (momentum trainer) "~,5E")
    (weight-decay (weight-decay trainer) "~,5E")
    (weight-penalty (weight-penalty trainer) "~,5E")
    (n-after-upate-hook (length (after-update-hook trainer)) "~S")
  
negative.code:         (dotimes (i (length weight-deltas))
            (decf (aref weight-deltas i) weight-penalty))))
      (with-shape-and-displacement (weight-deltas)
        (with-shape-and-displacement (accumulator)
          (do-segment-set (segment :start-in-segment-set start-in-segment-set)
                          (segment-set trainer)
            (let ((weights (segment-weights segment)))
              (reshape-and-displace! weight-deltas (mat-size weights)
                                     start-in-segment-set)
              (reshape-and-displace! accumulator (mat-size weights)
                                     start-in-segment-set)
              (unless (zerop weight-decay)
                (mgl-mat:axpy! weight-decay weights weight-deltas)
                (mgl-mat:scal! (- 1 (* learning-rate weight-decay)) weights))
              #+nil
              (format t "~A: norm: ~S~%" (name segment)
                      (mgl-bp::norm weight-deltas))
              (mgl-mat:axpy! (- (/ learning-rate n-inputs)) accumulator weights)
              (mgl-mat:axpy! (- (* learning-rate momentum)) weight-deltas
                             weights)
              (unless (zerop weight-penalty)
                (add-sign! (* learning-rate weight-penalty) weights 0 accumulator)
                (axpy! 1 accumulator weights))))))
      (fill! (flt 0) accumulator)
      (setf (n-inputs-in-batch trainer) 0))
    (map nil #'funcall (after-update-hook trainer)))
  
  (defun update-all-weights/normal (trainer)
    (map nil #'funcall (before-update-hook trainer))
    (let ((accumulator (accumulator trainer))
          (weight-deltas (weight-deltas trainer))
          (learning-rate (learning-rate trainer))
          (n-inputs (flt (n-inputs-in-batch trainer)))
          (momentum (momentum trainer))
          (weight-decay (weight-decay trainer))
          (weight-penalty (weight-penalty trainer)))
      (declare (type flt learning-rate n-inputs momentum
                     weight-decay #+nil weight-penalty))
      (mgl-mat:scal! momentum weight-deltas)
      (mgl-mat:axpy! (flt (/ n-inputs)) accumulator weight-deltas)
      (with-shape-and-displacement (weight-deltas)
        (do-segment-set (segment :start-in-segment-set start-in-segment-set)
                        (segment-set trainer)
          (let ((weights (segment-weights segment)))
            (reshape-and-displace! weight-deltas (mat-size weights)
                                   start-in-segment-set)
            (unless (zerop weight-penalty)
              (add-sign! weight-penalty weights 1 weight-deltas))
            (unless (zerop weight-decay)
              (axpy! weight-decay weights weight-deltas))
            (mgl-mat:axpy! (- learning-rate) weight-deltas weights))))
      (fill! (flt 0) accumulator)
      (setf (n-inputs-in-batch trainer) 0))
  