Skip to main content

conv_general_dilated

Function conv_general_dilated 

Source
pub fn conv_general_dilated<B: Backend, T: Num>(
    lhs: &Array<B, T>,
    rhs: &Array<B, T>,
    window_strides: &[usize],
    padding: impl Into<Padding>,
    options: &ConvOptions,
) -> Array<B, T>
Expand description

lax.conv_general_dilated: a convolution with strides, padding, input and kernel dilation, any layout, and feature or batch groups, with the result in the operands’ type.

§Examples

use ruxla_core::{Array, Native, lax};

// NWC input and WIO kernel, as Flax lays them out.
let x = Array::<Native, f32>::from_vec(vec![1.0, 2.0, 3.0, 4.0], [1, 4, 1]);
let k = Array::<Native, f32>::from_vec(vec![1.0, 10.0], [2, 1, 1]);
let options = lax::ConvOptions {
    dimension_numbers: Some(lax::conv_dimension_numbers("NWC", "WIO", "NWC")),
    ..Default::default()
};
let y = lax::conv_general_dilated(&x, &k, &[1], lax::Padding::Same, &options);
assert_eq!(y.to_vec(), [21.0, 32.0, 43.0, 4.0]);

§Panics

See conv_general_dilated_with.