Coverage for src/flag_gems/runtime/backend/_spacemit/ops/conv_depthwise2d.py: 0%
10 statements
« prev ^ index » next coverage.py v7.6.9, created at 2026-06-05 07:36 +0800
« prev ^ index » next coverage.py v7.6.9, created at 2026-06-05 07:36 +0800
1import logging
3from .conv2d import conv2d
5logger = logging.getLogger(__name__)
8def _conv_depthwise2d(input, weight, kernel_size, bias, stride, padding, dilation):
9 logger.debug("GEMS_SPACEMIT DEPTHWISE")
10 assert (
11 input.ndim == 4
12 ), f"Invalid input tensor: must be 4D, received shape {input.shape}"
13 assert weight.shape[0] % input.shape[1] == 0, (
14 f"Output channels must be a multiple of input channels, received "
15 f"output channels {weight.shape[0]} and input channels {input.shape[1]}"
16 )
17 assert (
18 weight.shape[1] == 1
19 ), f"Input channels per group must be 1, received {weight.shape[1]}"
20 groups = input.shape[1]
21 return conv2d(input, weight, bias, stride, padding, dilation, groups)