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

Export `TensorIndexer to candle users #2477

Merged
merged 1 commit into from
Sep 13, 2024
Merged

Conversation

h1994st
Copy link
Contributor

@h1994st h1994st commented Sep 13, 2024

This pull request exports TensorIndexer to candle lib users, which allows users to implement the IndexOp trait with TensorIndexer specified as a part of the constraints.

pub struct CustomStruct {
    data: Tensor,
    // ...
}

impl<A> IndexOp<A> for CustomStruct
where
    A: Into<TensorIndexer>,
{
    fn i(&self, index: A) -> Result<Tensor, Error> {
        self.data.i(index)
    }
}

@LaurentMazare LaurentMazare merged commit ebf722b into huggingface:main Sep 13, 2024
10 checks passed
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.

2 participants