Skip to content

Commit

Permalink
chore: remove arc
Browse files Browse the repository at this point in the history
  • Loading branch information
FL33TW00D committed Jan 22, 2024
1 parent 73cf5a0 commit 4b289a7
Showing 1 changed file with 3 additions and 25 deletions.
28 changes: 3 additions & 25 deletions crates/ratchet-core/src/tensor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ mod tests {

println!("Successfully created tensors");

let ground: anyhow::Result<Tensor> = Python::with_gil(|py| {
let ground: anyhow::Result<()> = Python::with_gil(|py| {
let prg = PyModule::from_code(
py,
r#"
Expand All @@ -449,31 +449,9 @@ mod tests {
"x.py",
"x",
)?;

println!("About to send tensors to python");
let py_a = a.to_py::<f32>(&py);
println!("Converted A to pyo3 array");
let py_b = b.to_py::<f32>(&py);
println!("Converted B to pyo3 array");

let result = prg
.getattr("matmul")?
.call1((py_a, py_b))?
.extract::<&PyArrayDyn<f32>>()?;
Ok(Tensor::from(result))
Ok(())
});

let gpu_device = Device::request_device(DeviceRequest::GPU)?;
let a = a.to(gpu_device.clone())?;
let b = b.to(gpu_device)?;

let c = a.matmul(&b)?;
c.resolve()?;

let our_result = c.to(cpu_device)?;
println!("Ground: {:?}", ground);
println!("Our result: {:?}", our_result);

println!("Successfully created ground truth");
Ok(())
}
}

0 comments on commit 4b289a7

Please sign in to comment.