mirror of
https://github.com/huggingface/candle.git
synced 2025-06-15 18:28:24 +00:00
Apply suggestions from code review
This commit is contained in:

committed by
GitHub

parent
649202024c
commit
2c280007e8
14
README.md
14
README.md
@ -15,21 +15,11 @@ and ease of use. Try our online demos:
|
||||
Make sure that you have [`candle-core`](https://github.com/huggingface/candle/tree/main/candle-core) correctly installed as described in [**Installation**](https://huggingface.github.io/candle/guide/installation.html).
|
||||
|
||||
Let's see how to run a simple matrix multiplication.
|
||||
|
||||
We will need the [`anyhow`](https://docs.rs/anyhow/latest/anyhow/) package for our example, so let's also add it to our app.
|
||||
|
||||
```bash
|
||||
cd myapp
|
||||
cargo add anyhow
|
||||
```
|
||||
|
||||
Next, write the following to your `myapp/src/main.rs` file:
|
||||
|
||||
Write the following to your `myapp/src/main.rs` file:
|
||||
```rust
|
||||
use anyhow::Result;
|
||||
use candle_core::{Device, Tensor};
|
||||
|
||||
fn main() -> Result<()> {
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let device = Device::Cpu;
|
||||
|
||||
let a = Tensor::randn(0f32, 1., (2, 3), &device)?;
|
||||
|
@ -45,7 +45,7 @@ cd myapp
|
||||
cargo add --git https://github.com/huggingface/candle.git candle-core
|
||||
```
|
||||
|
||||
Finally, run `cargo build` to make sure everything can be correctly built.
|
||||
Finally, run `cargo run` to make sure everything can be correctly built.
|
||||
|
||||
```bash
|
||||
cargo run
|
||||
|
Reference in New Issue
Block a user