pub struct Conv2d {
pub w: Vec<f32>,
pub b: Vec<f32>,
pub oc: usize,
pub ic: usize,
pub k: usize,
}Expand description
2-D convolution, stride 1, square kernel, symmetric padding (pad = k/2). Parallel over output channels.
Fields§
§w: Vec<f32>§b: Vec<f32>§oc: usize§ic: usize§k: usizeImplementations§
Source§impl Conv2d
impl Conv2d
Sourcepub fn apply(&self, x: &[f32], h: usize, w: usize) -> Vec<f32>
pub fn apply(&self, x: &[f32], h: usize, w: usize) -> Vec<f32>
x: [ic, h, w] → [oc, h, w]. GPU first (implicit-GEMM Metal
kernel — no im2col matrix at all), gated to shapes where the
transfer is amortized; otherwise banded im2col + GEMM: bands of
output rows are lowered to a [rows·w, ic·k²] patch matrix and hit
fcd_ops::gemm_nt (Accelerate/AMX on macOS, the portable blocked
kernel elsewhere) — the band cap keeps the patch matrix ≤ ~128 MB
at any image size.
Auto Trait Implementations§
impl Freeze for Conv2d
impl RefUnwindSafe for Conv2d
impl Send for Conv2d
impl Sync for Conv2d
impl Unpin for Conv2d
impl UnsafeUnpin for Conv2d
impl UnwindSafe for Conv2d
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