Skip to main content

add_bottleneck_block

Function add_bottleneck_block 

Source
pub fn add_bottleneck_block(
    model: &mut SequentialModel,
    in_channels: usize,
    expand_channels: usize,
    out_channels: usize,
    stride: usize,
    epsilon: f32,
) -> Result<(), ModelError>
Expand description

Adds a MobileNetV2-style inverted bottleneck block to a SequentialModel.

Structure: Conv1x1 (expand) -> BN -> ReLU -> DepthwiseConv3x3 -> BN -> ReLU -> Conv1x1 (project) -> BN. Since we don’t have depthwise as a layer yet, we approximate with a grouped conv emulation. For now this builds a standard bottleneck: 1x1 expand -> 3x3 conv -> 1x1 project.