anchor.diff:  (defclass mnist-rbm (rbm) ())
   
   (defmethod set-input (samples (rbm mnist-rbm))
  -  (let ((inputs (find 'inputs (visible-chunks rbm)
  -                      :key #'name)))
  +  (let ((inputs (find 'inputs (visible-chunks rbm) :key #'name)))
       (when inputs
         (clamp-images samples (nodes inputs)))))
   
  
positive.code:                               :target expectations))
      (ce-error (->error :x predictions))))
  
  (defvar *bpn/4*)
  
  (defparameter *mnist-4-bpn-filename*
    (merge-pathnames "mnist-4.bpn" *mnist-save-dir*))
  
  (defun train-mnist/4 (&key quick-run-p)
    (setq *bpn/4* (build-maxout-mnist-bpn))
    (init-bpn-weights *bpn/4* :stddev 0.01)
    (train-mnist-bpn-gd *bpn/4* (training-images) (test-images)
                        :n-softmax-epochs 0
                        :n-epochs (if quick-run-p 2 3000)
                        :learning-rate (flt 1)
                        :learning-rate-decay (flt 0.998)
                        :l2-upper-bound (sqrt (flt 3.75)))
    (unless quick-run-p
      (save-weights *mnist-4-bpn-filename* *bpn/4*)))
  
  #|
  
  (progn
    (with-cuda ()
      (let ((*random-state* (sb-ext:seed-random-state 983274)))
        (train-mnist/1)))
  
    (with-cuda ()
      (let ((*random-state* (sb-ext:seed-random-state 983274)))
        (train-mnist/1 :load-dbn-p t :dropoutp t)))
  
    (with-cuda ()
      (let ((*random-state* (sb-ext:seed-random-state 983274)))
        (train-mnist/2)))
  
    (with-cuda ()
      (let ((*random-state* (sb-ext:seed-random-state 983274)))
        (train-mnist/2 :load-dbm-p t :dropoutp t)))
  
    (with-cuda ()
      (let ((*random-state* (sb-ext:seed-random-state 983274)))
        (train-mnist/3)))
  
    (with-cuda ()
      (let ((*random-state* (sb-ext:seed-random-state 983274)))
        (train-mnist/4))))
  
  (with-cuda ()
    (let ((*random-state* (sb-ext:seed-random-state 983274)))
      (train-mnist/2 :load-dbn-p t :dropoutp t)))
  
  (require :sb-sprof)
  
  
negative.code: ;;;; DBN training
  
  (defclass mnist-rbm-segment-trainer (batch-gd-trainer)
    ((n-inputs-in-epoch :initarg :n-inputs-in-epoch :reader n-inputs-in-epoch)))
  
  (defmethod learning-rate ((trainer mnist-rbm-segment-trainer))
    (let ((x (slot-value trainer 'learning-rate)))
  