summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/grad_tests.rs2
-rw-r--r--tests/tensor_tests.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/grad_tests.rs b/tests/grad_tests.rs
index e5ba68e8..432b1520 100644
--- a/tests/grad_tests.rs
+++ b/tests/grad_tests.rs
@@ -6,7 +6,7 @@ fn simple_grad() -> Result<()> {
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.id()).context("no grad for x")?;
+ let grad_x = grads.get(&x).context("no grad for x")?;
assert_eq!(x.to_vec1::<f32>()?, [3., 1., 4.]);
// y = x^2 + 5.x + 4
assert_eq!(y.to_vec1::<f32>()?, [28., 10., 40.]);
diff --git a/tests/tensor_tests.rs b/tests/tensor_tests.rs
index 01f6f66c..fb2d84d9 100644
--- a/tests/tensor_tests.rs
+++ b/tests/tensor_tests.rs
@@ -2,7 +2,7 @@ use candle::{DType, Device, Result, Tensor};
#[test]
fn zeros() -> Result<()> {
- let tensor = Tensor::zeros((5, 2), DType::F32, Device::Cpu);
+ let tensor = Tensor::zeros((5, 2), DType::F32, Device::Cpu)?;
let (dim1, dim2) = tensor.shape().r2()?;
assert_eq!(dim1, 5);
assert_eq!(dim2, 2);