Created
August 17, 2024 05:01
-
-
Save jmsdnns/22a8f7e7609352ae028eaaa4dc96f548 to your computer and use it in GitHub Desktop.
Simple demo of how to use Candle with Apple's GPU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use candle_core::{Device, Tensor}; | |
fn main() -> Result<(), Box<dyn std::error::Error>> { | |
let device = Device::new_metal(0)?; | |
let a = Tensor::randn(0f32, 1., (2, 3), &device)?; | |
let b = Tensor::randn(0f32, 1., (3, 4), &device)?; | |
let c = a.matmul(&b)?; | |
println!("{c}"); | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment