Type Alias Tensor4

Source
pub type Tensor4<const X: usize, const Y: usize, const Z: usize, const W: usize> = Tensor<Dim4<X, Y, Z, W>>;
Expand description

A 4-th order tensor.

Aliased Type§

struct Tensor4<const X: usize, const Y: usize, const Z: usize, const W: usize> {
    pub inner: <Dim4<X, Y, Z, W> as Dimension>::ArrayForm,
}

Fields§

§inner: <Dim4<X, Y, Z, W> as Dimension>::ArrayForm

Implementations§

Source§

impl<const X: usize, const Y: usize, const Z: usize, const W: usize> Tensor4<X, Y, Z, W>
where [f32; { _ }]: Sized,

Source

pub fn convolution<const KX: usize, const BX: usize, const KY: usize, const BY: usize, const KZ: usize, const BZ: usize, const KW: usize, const BW: usize>( &self, kernel: &Tensor4<KX, KY, KZ, KW>, stride: &[usize], ) -> Tensor4<BX, BY, BZ, BW>
where [f32; { _ }]: Sized,

Computes the convolution with padded 0.

§Stride

The stride parameter controls the amount that kernel moves in each iteration. Note that it panics when any elememt in stride[..4] is 0 or stride.len() < 4. If unsure, use &[1; 4]

§Note

Each dimension of the output must be ceil((self + kernel) / stride) - 1 or else there will be a runtime panic. It is not checked during compile time due to Rust type bound limits.