Skip to main content

ConvolutionLayer

Struct ConvolutionLayer 

Source
pub struct ConvolutionLayer<F>
where F: Float,
{ /* private fields */ }
Expand description

Rust implementation of a convolutional layer. The weight matrix shall have dimension (in that order) (input channels, output channels, kernel width, kernel height), to comply with the order in which pytorch weights are saved.

Implementations§

Source§

impl<F> ConvolutionLayer<F>
where F: 'static + Float + AddAssign,

Source

pub fn new( weights: ArrayBase<OwnedRepr<F>, Dim<[usize; 4]>>, bias_array: Option<ArrayBase<OwnedRepr<F>, Dim<[usize; 1]>>>, stride: usize, padding: Padding, ) -> ConvolutionLayer<F>

Creates new convolution layer. The weights are given in Pytorch layout. (out channels, in channels, kernel height, kernel width) Bias: (output height * output width, 1)

Source

pub fn new_tf( weights: ArrayBase<OwnedRepr<F>, Dim<[usize; 4]>>, bias_array: Option<ArrayBase<OwnedRepr<F>, Dim<[usize; 1]>>>, stride: usize, padding: Padding, ) -> ConvolutionLayer<F>

Creates new convolution layer. The weights are given in Tensorflow layout. (kernel height, kernel width, in channels, out channels)

Source

pub fn convolve( &self, image: &ArrayBase<OwnedRepr<F>, Dim<[usize; 3]>>, ) -> ArrayBase<OwnedRepr<F>, Dim<[usize; 3]>>

Analog to conv2d.

Trait Implementations§

Auto Trait Implementations§

§

impl<F> Freeze for ConvolutionLayer<F>

§

impl<F> RefUnwindSafe for ConvolutionLayer<F>
where F: RefUnwindSafe,

§

impl<F> Send for ConvolutionLayer<F>
where F: Send,

§

impl<F> Sync for ConvolutionLayer<F>
where F: Sync,

§

impl<F> Unpin for ConvolutionLayer<F>

§

impl<F> UnsafeUnpin for ConvolutionLayer<F>

§

impl<F> UnwindSafe for ConvolutionLayer<F>
where F: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.