pub struct SeparableConv2dLayer { /* private fields */ }Expand description
Separable 2D convolution layer (NHWC layout).
Composed of a depthwise convolution followed by a pointwise (1x1) convolution.
Depthwise kernel shape: [KH, KW, C_in, 1], pointwise kernel: [1, 1, C_in, C_out].
Implementations§
Source§impl SeparableConv2dLayer
impl SeparableConv2dLayer
pub fn new( in_channels: usize, out_channels: usize, kernel_h: usize, kernel_w: usize, stride_h: usize, stride_w: usize, depthwise_weight: Tensor, pointwise_weight: Tensor, bias: Option<Tensor>, ) -> Result<Self, ModelError>
pub fn zero_init( in_channels: usize, out_channels: usize, kernel_h: usize, kernel_w: usize, stride_h: usize, stride_w: usize, use_bias: bool, ) -> Result<Self, ModelError>
pub fn register_params(&mut self, graph: &mut Graph)
pub fn sync_from_graph(&mut self, graph: &Graph) -> Result<(), ModelError>
pub fn in_channels(&self) -> usize
pub fn out_channels(&self) -> usize
pub fn kernel_h(&self) -> usize
pub fn kernel_w(&self) -> usize
pub fn stride_h(&self) -> usize
pub fn stride_w(&self) -> usize
pub fn depthwise(&self) -> &DepthwiseConv2dLayer
pub fn pointwise(&self) -> &Conv2dLayer
pub fn depthwise_mut(&mut self) -> &mut DepthwiseConv2dLayer
pub fn pointwise_mut(&mut self) -> &mut Conv2dLayer
pub fn forward( &self, graph: &mut Graph, input: NodeId, ) -> Result<NodeId, ModelError>
pub fn forward_inference(&self, input: &Tensor) -> Result<Tensor, ModelError>
Trait Implementations§
Source§impl Clone for SeparableConv2dLayer
impl Clone for SeparableConv2dLayer
Source§fn clone(&self) -> SeparableConv2dLayer
fn clone(&self) -> SeparableConv2dLayer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SeparableConv2dLayer
impl Debug for SeparableConv2dLayer
Source§impl PartialEq for SeparableConv2dLayer
impl PartialEq for SeparableConv2dLayer
impl StructuralPartialEq for SeparableConv2dLayer
Auto Trait Implementations§
impl Freeze for SeparableConv2dLayer
impl RefUnwindSafe for SeparableConv2dLayer
impl Send for SeparableConv2dLayer
impl Sync for SeparableConv2dLayer
impl Unpin for SeparableConv2dLayer
impl UnsafeUnpin for SeparableConv2dLayer
impl UnwindSafe for SeparableConv2dLayer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more