Skip to content

Use CozoDB with PyTorch #120

Answered by zh217
chengzegang asked this question in Q&A
May 17, 2023 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Unfortunately there is currently no better way to do it. Ideally we could just pass in pytorch or numpy tensors into the parameters and PyCozo would recognize it as a vector, unfortunately this involves two language barriers (C/C++ -> Python -> Rust) and we don't want to depend on the pytorch or numpy C/C++ library. Maybe we could have a function that converts blobs to vectors in Cozo, at least to deal with the memory problem.

MAYBE there's some black magic that can be done to determine the object passed in is a numpy/pytorch tensor AND get its underlying bytes. If that's possible AND the procedure does not need any knowlegde about numpy/pytorch at compile time, then everything is solved.…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@chengzegang
Comment options

@infogulch
Comment options

Answer selected by chengzegang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants