query-cleanup-mem should return entry, not ffirst?
benjamin-asdf opened this issue · comments
Benjamin commented
Hello
;; current:
(do
(vb/reset-mem!)
(vb/add-hdv! :name)
(vb/add-hdv! "alice")
(vb/add-hdv! "bob")
(def
H
(->
(vb/bind
(vb/get-hdv :name)
(vb/get-hdv "alice"))
(vb/bundle
(vb/bind
(vb/get-hdv :name)
(vb/get-hdv "bob")))))
(vb/unbind-get H "alice" nil true))
[:name #tech.v3.tensor<int8>[10000]
[1 1 -1 ... -1 -1 -1]]
;; there is no :dot and :cos-sim but I wanted verbose
;; use first instead of ffirst
(do
(vb/reset-mem!)
(vb/add-hdv! :name)
(vb/add-hdv! "alice")
(vb/add-hdv! "bob")
(def
H
(->
(vb/bind
(vb/get-hdv :name)
(vb/get-hdv "alice"))
(vb/bundle
(vb/bind
(vb/get-hdv :name)
(vb/get-hdv "bob")))))
(vb/unbind-get H "alice" nil true))
{:name #tech.v3.tensor<int8>
[10000] [1 1 1 ... 1 1 1]
:dot 4970.0
:cos-sim 0.7049822692805826}
;; the output is a map instead
Carin Meier commented
Good question. The verbose feature was added on a bit later in my explorations and was meant to help my use cases.
Feel free to use this code as a launching point for however you best think it should evolve.