chickadee » nanograd » get-or-make-lazy

get-or-make-lazy mvprocedure

Returns the lazy tensor for mv, creating it if needed. Use this procedure to wrap input data:

(import array-morphisms-core (prefix array-morphisms-grad am:))

;; A batch of 32 grayscale 28x28 images, without copying the data
(define x-lt
  (get-or-make-lazy
   (am:make-var (make-morphism image-data '(32 1 28 28) 'f32)
                #f)))  ; no gradient for the input