{"record":{"id":"5df26be1d5623d87","repo":"tensorflow/models","slug":"the-number-of-input-channels-must-be-divisible-by","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/modeling/mosaic_blocks.py","lineNumber":108,"sourceCode":"    # helps quantization where conv+bn+activation are fused into a single op.\n    self._activation_fn = tf_utils.get_activation(activation)\n    if self._use_sync_bn:\n      self._bn_op = tf_keras.layers.experimental.SyncBatchNormalization\n    else:\n      self._bn_op = tf_keras.layers.BatchNormalization\n\n    if tf_keras.backend.image_data_format() == 'channels_last':\n      self._bn_axis = -1\n      self._group_split_axis = -1\n    else:\n      self._bn_axis = 1\n      self._group_split_axis = 1\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    self._conv_branches = []\n    if self._use_depthwise_convolution:\n      for i, conv_kernel_size in enumerate(self._kernel_sizes):\n        depthwise_conv = tf_keras.layers.DepthwiseConv2D(\n            kernel_size=(conv_kernel_size, conv_kernel_size),\n            depth_multiplier=1,\n            padding='same',\n            depthwise_regularizer=self._kernel_regularizer,\n            depthwise_initializer=self._kernel_initializer,\n            use_bias=False)\n        # Add BN->RELU after depthwise convolution.\n        batchnorm_op_depthwise = self._bn_op(\n            axis=self._bn_axis,\n            momentum=self._batchnorm_momentum,\n            epsilon=self._batchnorm_epsilon)\n        activation_depthwise = self._activation_fn\n        feature_conv = tf_keras.layers.Conv2D(","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/mosaic/modeling/mosaic_blocks.py#L90-L126","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/modeling/mosaic_blocks.py:108 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"}