{"record":{"id":"df1328eec3e5bab2","repo":"tensorflow/models","slug":"requested-downsampling-at-a-non-existing-middle-de-df1328","errorCode":null,"errorMessage":"Requested downsampling at a non-existing middle depthwise.","messagePattern":"Requested downsampling at a non-existing middle depthwise\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/modeling/layers/nn_blocks.py","lineNumber":893,"sourceCode":"    self._stochastic_depth_drop_rate = stochastic_depth_drop_rate\n    self._dilation_rate = dilation_rate\n    self._use_sync_bn = use_sync_bn\n    self._regularize_depthwise = regularize_depthwise\n    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.'\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.'\n        )\n\n    if use_sync_bn:\n      self._norm = tf_keras.layers.experimental.SyncBatchNormalization\n    else:\n      self._norm = tf_keras.layers.BatchNormalization\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:","sourceCodeStart":875,"sourceCodeEnd":911,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/modeling/layers/nn_blocks.py#L875-L911","documentation":"Error \"Requested downsampling at a non-existing middle depthwise.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/modeling/layers/nn_blocks.py:893 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set downsample_in_middle of the block to False or add a middle depthwise conv.","Use the correct block variant whose architecture includes a middle depthwise layer."],"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"}