huggingface / huggingface/candle
Math is difficult to implement
- Dominant language
- Rust
- Stars
- 21k
- Forks
- 1.8k
- Avg merge
- 16h 42m
- Merged PRs (30d)
- 25
Description
In Python it's possible to write just this:
`3 * x**2 - 4*x + 5`
With Candle it currently looks like this, which is difficult to read and write:
`Ok((&(&(&x.powf(2.0)? * 3.0)? - &x * 4.0)? + 5.0)?)`
1. Why does everything return a Result? I assume the reason is that the GPU connection might fail, but in that case maybe it's okay to panic the whole application?
2. Why is Tensor not Copy? It's an Arc, so it would be okay in theory.
3. A few more traits can be implemented to make it look like this: `3.0 * x * x - 4.0 * x - 5.0`
I wrote an example here:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=e5abf73c9e38fb6cef2c17b5a1898a29
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the Rust playground example linked in the issue and inspect Candle's Tensor arithmetic and error-handling APIs. Review the existing comment discussion before deciding whether the goal is operator traits, Tensor copying, or a different error policy; done requires an agreed scope and corresponding ergonomic API changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100