MCPcopy Create free account
hub / github.com/evilsocket/cake / conv2d

Method conv2d

cake-core/src/backends/mod.rs:658–676  ·  view source on GitHub ↗
(
        &self,
        x: &Tensor,
        weight: &Tensor,
        bias: Option<&Tensor>,
        padding: usize,
        stride: usize,
        dilation: usize,
        groups: usize,
    )

Source from the content-addressed store, hash-verified

656 /// Input: `(batch, in_channels, height, width)`, weight: `(out_channels, in_channels/groups, kH, kW)`.
657 #[allow(clippy::too_many_arguments)]
658 fn conv2d(
659 &self,
660 x: &Tensor,
661 weight: &Tensor,
662 bias: Option<&Tensor>,
663 padding: usize,
664 stride: usize,
665 dilation: usize,
666 groups: usize,
667 ) -> Result<Tensor> {
668 let out = x.conv2d(weight, padding, stride, dilation, groups)?;
669 match bias {
670 Some(b) => {
671 let b = b.reshape((1, b.dim(0)?, 1, 1))?;
672 out.broadcast_add(&b)
673 }
674 None => Ok(out),
675 }
676 }
677
678 // ── Device control ───────────────────────────────────────────────
679

Callers 3

conv2dFunction · 0.80
forwardMethod · 0.80

Implementers 5

mod.rscake-core/src/backends/rocm/mod.rs
mod.rscake-core/src/backends/cpu/mod.rs
mod.rscake-core/src/backends/metal/mod.rs
mod.rscake-core/src/backends/vulkan/mod.rs
mod.rscake-core/src/backends/cuda/mod.rs

Calls

no outgoing calls

Tested by 1