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

Adding support for integer indexing [0, :2, -1]. #440

Merged
merged 2 commits into from
Feb 16, 2024
Merged

Adding support for integer indexing [0, :2, -1]. #440

merged 2 commits into from
Feb 16, 2024

Conversation

Narsil
Copy link
Collaborator

@Narsil Narsil commented Feb 14, 2024

What does this PR do?

Fixes #439

Adds support for integer indexing.

Fixes # (issue) or description of the problem this PR solves.

Comment on lines +195 to +198
.checked_add_signed(idx as isize)
.ok_or(SafetensorError::new_err(format!(
"Invalid index {idx} for dimension {dim_idx} of size {dim}"
)))?;

Choose a reason for hiding this comment

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

let's make sure we test the panic

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is checked, the other out of bounds wasn´t, I added it.

@Narsil Narsil merged commit b947b59 into main Feb 16, 2024
3 checks passed
@Narsil Narsil deleted the slice_index branch February 16, 2024 09:14
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.

Slice loading errors with integer indices
2 participants