From 90374097dc99b14dfc935318a18c21fc5909291f Mon Sep 17 00:00:00 2001 From: Laurent Mazare Date: Mon, 14 Aug 2023 21:30:41 +0100 Subject: Cudnn support (#445) * Add a cudnn feature to be used for conv2d. * Allocate the proper workspace. * Only create a single cudnn handle per cuda device. * Proper cudnn usage. * Bugfix. --- candle-core/examples/cuda_basics.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'candle-core/examples/cuda_basics.rs') diff --git a/candle-core/examples/cuda_basics.rs b/candle-core/examples/cuda_basics.rs index d902b9d5..12febb60 100644 --- a/candle-core/examples/cuda_basics.rs +++ b/candle-core/examples/cuda_basics.rs @@ -9,10 +9,9 @@ use candle_core::{Device, Tensor}; fn main() -> Result<()> { let device = Device::new_cuda(0)?; - let t = Tensor::new(&[[1f32, 2., 3., 4.2]], &device)?; - let sum = t.sum_keepdim(0)?; - println!("{sum}"); - let sum = t.sum_keepdim(1)?; - println!("{sum}"); + 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)?; + println!("{res:?}"); Ok(()) } -- cgit v1.2.3