pub struct Conv2d { /* private fields */ }Expand description
Trainable grouped FP32 two-dimensional convolution over NCHW matrices.
Implementations§
Source§impl Conv2d
impl Conv2d
Sourcepub fn new_with_seed(
input_channels: usize,
output_channels: usize,
kernel_size: usize,
stride: usize,
padding: usize,
groups: usize,
seed: u64,
) -> Result<Self>
pub fn new_with_seed( input_channels: usize, output_channels: usize, kernel_size: usize, stride: usize, padding: usize, groups: usize, seed: u64, ) -> Result<Self>
Construct a deterministically initialized grouped Conv2d layer.
The weight initializer is symmetric uniform with bound
1 / sqrt((input_channels / groups) * kernel_size²); bias starts at zero.
§Errors
Returns an error when dimensions are zero, channels are not divisible by
groups, shape arithmetic overflows, or allocation/upload fails.
pub fn new_with_seed_on( runtime: &Runtime, input_channels: usize, output_channels: usize, kernel_size: usize, stride: usize, padding: usize, groups: usize, seed: u64, ) -> Result<Self>
Sourcepub fn new_from_matrices(
weight: Matrix,
bias: Matrix,
stride: usize,
padding: usize,
groups: usize,
) -> Result<Self>
pub fn new_from_matrices( weight: Matrix, bias: Matrix, stride: usize, padding: usize, groups: usize, ) -> Result<Self>
Construct Conv2d from exact grouped OIHW weight and bias matrices.
§Errors
Returns an error unless weight is nonempty square-kernel F32 OIHW/group, bias is matching same-runtime F32, stride/groups are nonzero, and output channels are divisible by groups.
Sourcepub fn forward(&self, input: &Matrix) -> Result<Matrix>
pub fn forward(&self, input: &Matrix) -> Result<Matrix>
Apply grouped convolution without submitting or waiting.
§Errors
Returns an error from the underlying Matrix operation.
Sourcepub const fn input_channels(&self) -> usize
pub const fn input_channels(&self) -> usize
Return the input channel count.
Sourcepub const fn output_channels(&self) -> usize
pub const fn output_channels(&self) -> usize
Return the output channel count.
Sourcepub const fn kernel_size(&self) -> usize
pub const fn kernel_size(&self) -> usize
Return the square kernel extent.
Sourcepub fn parameters(&self) -> [Parameter; 2]
pub fn parameters(&self) -> [Parameter; 2]
Return parameters in deterministic weight, bias order.
Trait Implementations§
Source§impl Module for Conv2d
impl Module for Conv2d
Source§fn forward(&self, input: &Matrix) -> Result<Matrix>
fn forward(&self, input: &Matrix) -> Result<Matrix>
Source§fn registry(&self) -> &ModuleRegistry
fn registry(&self) -> &ModuleRegistry
Source§fn parameters(&self) -> Vec<Parameter>
fn parameters(&self) -> Vec<Parameter>
Source§fn named_parameters(&self) -> Vec<NamedParameter>
fn named_parameters(&self) -> Vec<NamedParameter>
Source§fn named_buffers(&self) -> Vec<NamedBuffer>
fn named_buffers(&self) -> Vec<NamedBuffer>
Source§fn all_parameters(&self) -> Result<Vec<Parameter>>
fn all_parameters(&self) -> Result<Vec<Parameter>>
Source§fn all_named_parameters(&self) -> Result<Vec<NamedParameter>>
fn all_named_parameters(&self) -> Result<Vec<NamedParameter>>
Source§fn all_named_buffers(&self) -> Result<Vec<NamedBuffer>>
fn all_named_buffers(&self) -> Result<Vec<NamedBuffer>>
Source§fn all_named_state_u32(&self) -> Result<Vec<NamedStateU32>>
fn all_named_state_u32(&self) -> Result<Vec<NamedStateU32>>
u32 scalar state in
deterministic depth-first order. Read more