{"record":{"id":"f061d2583265b705","repo":"tensorflow/models","slug":"number-of-filters-conv-filters-is-not-divisible","errorCode":null,"errorMessage":"Number of filters: {conv_filters} is not divisible by size of the groups: {group_size}","messagePattern":"Number of filters: (.+?) is not divisible by size of the groups: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/edgetpu/vision/modeling/mobilenet_edgetpu_v2_model_blocks.py","lineNumber":699,"sourceCode":"                      strides: Any = (1, 1),\n                      group_size: Optional[int] = None,\n                      use_batch_norm: bool = True,\n                      use_bias: bool = False,\n                      activation: Any = None,\n                      name: Optional[str] = None) -> tf_keras.layers.Layer:\n  \"\"\"2D group convolution with batchnorm and activation.\"\"\"\n  batch_norm = common_modules.get_batch_norm(config.batch_norm)\n  bn_momentum = config.bn_momentum\n  bn_epsilon = config.bn_epsilon\n  data_format = tf_keras.backend.image_data_format()\n  weight_decay = config.weight_decay\n  if group_size is None:\n    group_size = config.group_base_size\n\n  name = name or ''\n  # Compute the # of groups\n  if conv_filters % group_size != 0:  # pyrefly: ignore[unsupported-operation]\n    raise ValueError(f'Number of filters: {conv_filters} is not divisible by '\n                     f'size of the groups: {group_size}')\n  groups = int(conv_filters / group_size)  # pyrefly: ignore[unsupported-operation]\n  # Collect args based on what kind of groupconv2d block is desired\n  init_kwargs = {\n      'kernel_size': kernel_size,\n      'strides': strides,\n      'use_bias': use_bias,\n      'padding': 'same',\n      'name': name + '_groupconv2d',\n      'kernel_regularizer': tf_keras.regularizers.l2(weight_decay),\n      'bias_regularizer': tf_keras.regularizers.l2(weight_decay),\n      'filters': conv_filters,\n      'groups': groups,\n      'batch_norm_layer': batch_norm if use_batch_norm else None,\n      'bn_epsilon': bn_epsilon,\n      'bn_momentum': bn_momentum,\n      'activation': activation,\n      'data_format': data_format,","sourceCodeStart":681,"sourceCodeEnd":717,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/edgetpu/vision/modeling/mobilenet_edgetpu_v2_model_blocks.py#L681-L717","documentation":"Error \"Number of filters: {conv_filters} is not divisible by size of the groups: {group_size}\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/edgetpu/vision/modeling/mobilenet_edgetpu_v2_model_blocks.py:699 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"}