Closed hikettei closed 1 year ago
With the lazy and lazy-reduce functions, users can benefit from loop optimization of cl-waffe2 without adding new backend.
lazy
lazy-reduce
;; Example: (lazy #'sin (randn `(3 3)) :diff #'cos)
(defun topk (k) #'(lambda (&rest args) (let ((topN (sort args #'>))) (apply #'values (loop for n upfrom 0 below K collect (nth n topN)))))) (lazy-reduce (topk 3) (ax+b `(10 10) 1 0) :reduce-to 3) (defun my-topk (tensor k) (lazy-reduce (topk K) tensor :reduce-to k)) (my-topk (ax+b `(10 10) 1 0) 3)
Changes
Added: lazy, lazy-reduce
With the
lazy
andlazy-reduce
functions, users can benefit from loop optimization of cl-waffe2 without adding new backend.APIs