mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 10:38:54 +00:00
improve
This commit is contained in:
@ -99,8 +99,9 @@ Having installed `candle` with Cuda support, you can create the tensors on GPU i
|
|||||||
```diff
|
```diff
|
||||||
- let a = Tensor::randn(0f32, 1., (2, 3), &Device::Cpu)?;
|
- let a = Tensor::randn(0f32, 1., (2, 3), &Device::Cpu)?;
|
||||||
- let b = Tensor::randn(0f32, 1., (3, 4), &Device::Cpu)?;
|
- let b = Tensor::randn(0f32, 1., (3, 4), &Device::Cpu)?;
|
||||||
+ let a = Tensor::randn(0f32, 1., (2, 3), &Device::new_cuda(0)?)?;
|
+ let device = Device::new_cuda(0)?;
|
||||||
+ let b = Tensor::randn(0f32, 1., (3, 4), &Device::new_cuda(0)?)?;
|
+ let a = Tensor::randn(0f32, 1., (2, 3), &device)?;
|
||||||
|
+ let b = Tensor::randn(0f32, 1., (3, 4), &device)?;
|
||||||
```
|
```
|
||||||
|
|
||||||
For more advanced examples, please have a look at the following sections.
|
For more advanced examples, please have a look at the following sections.
|
||||||
|
Reference in New Issue
Block a user