mirror of
https://github.com/huggingface/candle.git
synced 2025-06-18 11:37:11 +00:00
Use a reference for the device.
This commit is contained in:
@ -3,7 +3,7 @@ use candle::{Device, Tensor};
|
||||
|
||||
#[test]
|
||||
fn simple_grad() -> Result<()> {
|
||||
let x = Tensor::var(&[3f32, 1., 4.], Device::Cpu)?;
|
||||
let x = Tensor::var(&[3f32, 1., 4.], &Device::Cpu)?;
|
||||
let y = (((&x * &x)? + &x * 5f64)? + 4f64)?;
|
||||
let grads = y.backward()?;
|
||||
let grad_x = grads.get(&x).context("no grad for x")?;
|
||||
|
Reference in New Issue
Block a user