Skip to content

feat(python): support array and tensor conversions for DenseVector - #97

Open
dhairyathareja1 wants to merge 2 commits into
sdslabs:mainfrom
dhairyathareja1:feat/densevector-tensors
Open

dhairyathareja1 wants to merge 2 commits into
sdslabs:mainfrom
dhairyathareja1:feat/densevector-tensors

Conversation

@dhairyathareja1

Copy link
Copy Markdown

Adds duck typed support for NumPy arrays and PyTorch, TensorFlow, and JAX tensors in DenseVector, with reverse conversion helpers, tests, and documentation.

Tests: python -m pytest -q (99 passed)

Closes #69

@4adex
4adex requested a review from peopleig September 29, 2026 06:04

@peopleig peopleig left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty good
Run ruff on this once though

Comment thread client/python/vortexdb/models.py Outdated
raise ValueError("DenseVector expects a one-dimensional vector")

for v in normalized_values:
if not isinstance(v, (int, float)):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A list of numpy floats is not accepted.
Should change this to if not isinstance(v, (int, float, numbers.Real)), or simply if not isinstance(v, numbers.Real)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved. I ran ruff and fixed all reported findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow DenseVector construction from NumPy arrays and tensors

2 participants