Add a test for conv2d with padding + bugfix the random number generation on cuda. (#578)

* Add a test for conv2d with padding.

* Cosmetic changes.

* Bugfix the rand function on the cuda backend.
This commit is contained in:
Laurent Mazare
2023-08-24 10:16:37 +01:00
committed by GitHub
parent 79916c2edb
commit dd64465899
3 changed files with 24 additions and 8 deletions

View File

@ -9,6 +9,9 @@ use candle_core::{Device, Tensor};
fn main() -> Result<()> {
let device = Device::new_cuda(0)?;
let t = Tensor::rand(-1f32, 1f32, 96, &device)?;
println!("{t}");
let t = Tensor::randn(0f32, 1f32, (2, 4, 96, 96), &device)?;
let w = Tensor::randn(0f32, 1f32, (320, 4, 3, 3), &device)?;
let res = t.conv2d(&w, 1, 1, 1)?;