diff options
author | laurent <laurent.mazare@gmail.com> | 2023-06-22 13:52:02 +0100 |
---|---|---|
committer | laurent <laurent.mazare@gmail.com> | 2023-06-22 13:52:02 +0100 |
commit | e1eb86db61d789627105ca0929b9fd83b1bf991e (patch) | |
tree | 9c22ec9542d9eecf18104e3674b492ec6d677836 /examples/cuda_basics.rs | |
parent | 83d619800950a5f4314fa6bb885835dbfbf9dfcf (diff) | |
download | candle-e1eb86db61d789627105ca0929b9fd83b1bf991e.tar.gz candle-e1eb86db61d789627105ca0929b9fd83b1bf991e.tar.bz2 candle-e1eb86db61d789627105ca0929b9fd83b1bf991e.zip |
Add some first binary op (add).
Diffstat (limited to 'examples/cuda_basics.rs')
-rw-r--r-- | examples/cuda_basics.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/cuda_basics.rs b/examples/cuda_basics.rs index 046091a3..52a45999 100644 --- a/examples/cuda_basics.rs +++ b/examples/cuda_basics.rs @@ -5,9 +5,9 @@ fn main() -> Result<()> { let device = Device::new_cuda(0)?; let x = Tensor::new(&[3f32, 1., 4., 1., 5.], &device)?; println!("{:?}", x.to_vec1::<f32>()?); - let x = Tensor::new(&[2f32, 7., 1., 8., 2.], &device)?; - let y = (x * 3.)?; - println!("{:?}", y.to_vec1::<f32>()?); + let y = Tensor::new(&[2f32, 7., 1., 8., 2.], &device)?; + let z = (y + x * 3.)?; + println!("{:?}", z.to_vec1::<f32>()?); let x = Tensor::ones((3, 2), DType::F32, &device)?; println!("{:?}", x.to_vec2::<f32>()?); Ok(()) |