mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 10:38:54 +00:00
Dilated convolutions (#657)
* 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.
This commit is contained in:
@ -278,6 +278,7 @@ impl EncodecConv1d {
|
||||
padding: 0,
|
||||
stride,
|
||||
groups: 1,
|
||||
dilation: 1,
|
||||
},
|
||||
vb.pp("conv"),
|
||||
)?,
|
||||
@ -289,6 +290,7 @@ impl EncodecConv1d {
|
||||
padding: 0,
|
||||
stride,
|
||||
groups: 1,
|
||||
dilation: 1,
|
||||
},
|
||||
vb.pp("conv"),
|
||||
)?,
|
||||
|
@ -66,6 +66,7 @@ impl ResnetBlock2D {
|
||||
stride: 1,
|
||||
padding: 1,
|
||||
groups: 1,
|
||||
dilation: 1,
|
||||
};
|
||||
let norm1 = nn::group_norm(config.groups, in_channels, config.eps, vs.pp("norm1"))?;
|
||||
let conv1 = conv2d(in_channels, out_channels, 3, conv_cfg, vs.pp("conv1"))?;
|
||||
@ -80,6 +81,7 @@ impl ResnetBlock2D {
|
||||
stride: 1,
|
||||
padding: 0,
|
||||
groups: 1,
|
||||
dilation: 1,
|
||||
};
|
||||
Some(conv2d(
|
||||
in_channels,
|
||||
|
@ -281,11 +281,13 @@ impl AudioEncoder {
|
||||
padding: 1,
|
||||
stride: 1,
|
||||
groups: 1,
|
||||
dilation: 1,
|
||||
};
|
||||
let cfg2 = Conv1dConfig {
|
||||
padding: 1,
|
||||
stride: 2,
|
||||
groups: 1,
|
||||
dilation: 1,
|
||||
};
|
||||
let conv1 = conv1d(cfg.num_mel_bins, n_state, 3, cfg1, vb.pp("conv1"))?;
|
||||
let conv2 = conv1d(n_state, n_state, 3, cfg2, vb.pp("conv2"))?;
|
||||
|
@ -132,6 +132,7 @@ fn conv(vb: VarBuilder, index: usize, p: usize, b: &Block) -> Result<(usize, Bl)
|
||||
stride,
|
||||
padding,
|
||||
groups: 1,
|
||||
dilation: 1,
|
||||
};
|
||||
let conv = if bias {
|
||||
conv2d(p, filters, size, conv_cfg, vb.pp(&format!("conv_{index}")))?
|
||||
|
@ -93,6 +93,7 @@ impl ConvBlock {
|
||||
padding,
|
||||
stride,
|
||||
groups: 1,
|
||||
dilation: 1,
|
||||
};
|
||||
let conv = conv2d_no_bias(c1, c2, k, cfg, vb.pp("conv"))?;
|
||||
let bn = batch_norm(c2, 1e-3, vb.pp("bn"))?;
|
||||
|
Reference in New Issue
Block a user