pub struct DeformableConv2dLayer {
pub weight: Tensor,
pub offset_weight: Tensor,
pub bias: Option<Tensor>,
pub stride: usize,
pub padding: usize,
pub kernel_h: usize,
pub kernel_w: usize,
/* private fields */
}Expand description
Deformable 2D convolution layer (NHWC layout).
Like standard conv2d but sampling positions are offset by learned offsets. An internal offset convolution produces offsets from the input, then those offsets are used to sample input with bilinear interpolation.
Weight shape: [kH, kW, C_in, C_out].
Offset weight shape: [kH, kW, C_in, kH*kW*2] – conv producing offsets.
Fields§
§weight: Tensor§offset_weight: Tensor§bias: Option<Tensor>§stride: usize§padding: usize§kernel_h: usize§kernel_w: usizeImplementations§
Source§impl DeformableConv2dLayer
impl DeformableConv2dLayer
pub fn new( in_channels: usize, out_channels: usize, kernel_h: usize, kernel_w: usize, stride: usize, padding: usize, weight: Tensor, offset_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: usize, padding: usize, use_bias: bool, ) -> Result<Self, 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(&self) -> usize
pub fn padding(&self) -> usize
pub fn weight(&self) -> &Tensor
pub fn offset_weight(&self) -> &Tensor
pub fn bias(&self) -> Option<&Tensor>
pub fn weight_node(&self) -> Option<NodeId>
pub fn register_params(&mut self, graph: &mut Graph)
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 DeformableConv2dLayer
impl Clone for DeformableConv2dLayer
Source§fn clone(&self) -> DeformableConv2dLayer
fn clone(&self) -> DeformableConv2dLayer
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 DeformableConv2dLayer
impl Debug for DeformableConv2dLayer
Source§impl PartialEq for DeformableConv2dLayer
impl PartialEq for DeformableConv2dLayer
impl StructuralPartialEq for DeformableConv2dLayer
Auto Trait Implementations§
impl Freeze for DeformableConv2dLayer
impl RefUnwindSafe for DeformableConv2dLayer
impl Send for DeformableConv2dLayer
impl Sync for DeformableConv2dLayer
impl Unpin for DeformableConv2dLayer
impl UnsafeUnpin for DeformableConv2dLayer
impl UnwindSafe for DeformableConv2dLayer
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