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

convert pytorch's tensor in Python API #1172

Merged
merged 2 commits into from
Oct 25, 2023

Conversation

macroexpansion
Copy link
Contributor

regarding #1087, this PR implements the ability to convert torch tensor from/to candle tensor as follows:

  • candle to torch: extract candle tensor value and use PyO3 interop to create torch tensor.
  • torch to candle: extract numpy value from the input torch tensor using PyO3 interop and create candle tensor with it.

Copy link
Collaborator

@LaurentMazare LaurentMazare left a comment

Choose a reason for hiding this comment

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

Looks nice and a very small change, thanks!

candle-pyo3/test.py Outdated Show resolved Hide resolved
@LaurentMazare LaurentMazare merged commit 6a446d9 into huggingface:main Oct 25, 2023
11 of 13 checks passed
@LaurentMazare
Copy link
Collaborator

Merged, thanks again for the PR!

@macroexpansion macroexpansion deleted the convert-pytorch-tensor branch October 25, 2023 18:48
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