Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String tensor support #90

Merged
merged 8 commits into from
Dec 1, 2021
Merged

String tensor support #90

merged 8 commits into from
Dec 1, 2021

Conversation

GuyAv46
Copy link
Contributor

@GuyAv46 GuyAv46 commented Nov 23, 2021

For now, added only support for STRING tensors set with VALUE.

when the data is given by VALUE (and not with BLOB)
for setting and getting string tensors by VALUE
from numpy string array as blob
to test tensorset with numpy string array
Copy link
Collaborator

@DvirDukhan DvirDukhan left a comment

Choose a reason for hiding this comment

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

Looks good, few comments

redisai/command_builder.py Show resolved Hide resolved
redisai/utils.py Outdated Show resolved Hide resolved
redisai/utils.py Outdated Show resolved Hide resolved
Added a comment.

Deleted numpy_string2blob and replaced with a single line using join.

Deleted utils.recursive_bytetransform_str and
sets 'target' to a decode function
Copy link
Collaborator

@alonre24 alonre24 left a comment

Choose a reason for hiding this comment

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

Good job :)

@@ -38,7 +43,9 @@ def blob2numpy(
"""Convert `BLOB` result from RedisAI to `np.ndarray`."""
mm = {"FLOAT": "float32", "DOUBLE": "float64"}
dtype = mm.get(dtype, dtype.lower())
if mutable:
if dtype == 'string':
a = np.array(value.decode().split('\0')[:-1], dtype='str')
Copy link
Collaborator

Choose a reason for hiding this comment

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

You take [:-1] because the last item is the empty string after the last \0in the blob right? Consider documenting it

@sonarcloud
Copy link

sonarcloud bot commented Dec 1, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@GuyAv46 GuyAv46 merged commit 15a67d7 into master Dec 1, 2021
@GuyAv46 GuyAv46 deleted the string_tensor_support branch December 1, 2021 13:38
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.

None yet

3 participants