{"record":{"id":"6958acadd2360d45","repo":"tensorflow/models","slug":"the-number-of-input-channels-must-be-divisible-by-6958ac","errorCode":null,"errorMessage":"The number of input channels must be divisible by the number of groups for evenly group split.","messagePattern":"The number of input channels must be divisible by the number of groups for evenly group split\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/mosaic/qat/modeling/layers/nn_blocks.py","lineNumber":43,"sourceCode":"from official.projects.qat.vision.quantization import helper\n\n\n@tf_keras.utils.register_keras_serializable(package='Vision')\nclass MultiKernelGroupConvBlockQuantized(mosaic_blocks.MultiKernelGroupConvBlock\n                                        ):\n  \"\"\"A quantized multi-kernel grouped convolution block.\n\n  This block is used in the segmentation neck introduced in MOSAIC.\n  Reference:\n   [MOSAIC: Mobile Segmentation via decoding Aggregated Information and encoded\n   Context](https://arxiv.org/pdf/2112.11623.pdf)\n  \"\"\"\n\n  def build(self, input_shape: tf.TensorShape) -> None:\n    \"\"\"Builds the block with the given input shape.\"\"\"\n    input_channels = input_shape[self._group_split_axis]\n    if input_channels % self._num_groups != 0:\n      raise ValueError('The number of input channels must be divisible by '\n                       'the number of groups for evenly group split.')\n\n    # Override the activation and bn with their quantized version.\n    self._activation_fn = tfmot.quantization.keras.QuantizeWrapperV2(\n        tf_utils.get_activation(self._activation, use_keras_layer=True),\n        configs.Default8BitActivationQuantizeConfig())\n    norm_layer = (\n        tf_keras.layers.experimental.SyncBatchNormalization\n        if self._use_sync_bn else tf_keras.layers.BatchNormalization)\n    norm_with_quantize = helper.BatchNormalizationQuantized(norm_layer)\n    norm_no_quantize = helper.BatchNormalizationNoQuantized(norm_layer)\n    self._bn_op = helper.norm_by_activation(\n        self._activation, norm_with_quantize, norm_no_quantize)\n\n    self._conv_branches = []\n    if self._use_depthwise_convolution:\n      for i, conv_kernel_size in enumerate(self._kernel_sizes):\n        depthwise_conv = helper.DepthwiseConv2DQuantized(","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/mosaic/qat/modeling/layers/nn_blocks.py#L25-L61","documentation":"Error \"The number of input channels must be divisible by the number of groups for evenly group split.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/mosaic/qat/modeling/layers/nn_blocks.py:43 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}