{"record":{"id":"824d8cdc8dca479d","repo":"tensorflow/models","slug":"requested-downsampling-at-a-non-existing-starting","errorCode":null,"errorMessage":"Requested downsampling at a non-existing starting depthwise conv.","messagePattern":"Requested downsampling at a non-existing starting depthwise conv\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/qat/vision/modeling/layers/nn_blocks.py","lineNumber":841,"sourceCode":"    self._use_residual = use_residual\n    self._activation = activation\n    self._depthwise_activation = depthwise_activation\n    self._kernel_initializer = kernel_initializer\n    self._use_layer_scale = use_layer_scale\n    self._layer_scale_init_value = layer_scale_init_value\n    self._norm_momentum = norm_momentum\n    self._norm_epsilon = norm_epsilon\n    self._kernel_regularizer = kernel_regularizer\n    self._bias_regularizer = bias_regularizer\n    self._output_intermediate_endpoints = output_intermediate_endpoints\n\n    if strides > 1:\n      if middle_dw_downsample and not middle_dw_kernel_size:\n        raise ValueError(\n            'Requested downsampling at a non-existing middle depthwise conv.'\n        )\n      if not middle_dw_downsample and not start_dw_kernel_size:\n        raise ValueError(\n            'Requested downsampling at a non-existing starting depthwise conv.'\n        )\n\n    if use_sync_bn:\n      norm_layer = tf_keras.layers.experimental.SyncBatchNormalization\n    else:\n      norm_layer = tf_keras.layers.BatchNormalization\n    self._norm_with_quantize = helper.BatchNormalizationQuantized(norm_layer)\n    self._norm = helper.BatchNormalizationNoQuantized(norm_layer)\n\n    if tf_keras.backend.image_data_format() == 'channels_last':\n      self._bn_axis = -1\n    else:\n      self._bn_axis = 1\n    if not depthwise_activation:\n      self._depthwise_activation = activation\n    if regularize_depthwise:\n      self._depthwise_regularizer = kernel_regularizer","sourceCodeStart":823,"sourceCodeEnd":859,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/qat/vision/modeling/layers/nn_blocks.py#L823-L859","documentation":"Constructor validation in the QAT ConvNet block: downsampling via the starting depthwise conv requires it to exist (start_dw_kernel_size > 1); requesting downsampling there when the conv is absent raises this ValueError.","triggerScenarios":"Thrown at official/projects/qat/vision/modeling/layers/nn_blocks.py:841 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set start_dw_kernel_size > 1 when downsampling at the starting depthwise conv","Disable downsampling for blocks without a starting depthwise conv","Fix the block config so strides and kernel sizes are consistent"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}