mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 18:48:51 +00:00

* Add the dilation parameter. * Restore the basic optimizer example. * Dilation support in cudnn. * Use the dilation parameter in the cpu backend. * More dilation support. * No support for dilation in transposed convolutions. * Add dilation to a test. * Remove a print. * Helper function.
19 lines
501 B
Rust
19 lines
501 B
Rust
#[cfg(feature = "mkl")]
|
|
extern crate intel_mkl_src;
|
|
|
|
#[cfg(feature = "accelerate")]
|
|
extern crate accelerate_src;
|
|
|
|
use anyhow::Result;
|
|
use candle_core::{Device, Tensor};
|
|
|
|
fn main() -> Result<()> {
|
|
let inp = Tensor::randn(0f32, 1., (2, 320, 96, 96), &Device::Cpu)?;
|
|
let w = Tensor::randn(0f32, 1., (320, 320, 3, 3), &Device::Cpu)?;
|
|
let start = std::time::Instant::now();
|
|
let res = inp.conv2d(&w, 0, 1, 1, 1)?;
|
|
println!("{:?}", start.elapsed());
|
|
println!("{res:?}");
|
|
Ok(())
|
|
}
|