tensorflow/models · error · ValueError
Requested downsampling at a non-existing middle depthwise.
Error message
Requested downsampling at a non-existing middle depthwise.
What it means
Error "Requested downsampling at a non-existing middle depthwise." thrown in tensorflow/models.
Source
Thrown at official/vision/modeling/layers/nn_blocks.py:893
self._stochastic_depth_drop_rate = stochastic_depth_drop_rate
self._dilation_rate = dilation_rate
self._use_sync_bn = use_sync_bn
self._regularize_depthwise = regularize_depthwise
self._use_residual = use_residual
self._activation = activation
self._depthwise_activation = depthwise_activation
self._kernel_initializer = kernel_initializer
self._use_layer_scale = use_layer_scale
self._layer_scale_init_value = layer_scale_init_value
self._norm_momentum = norm_momentum
self._norm_epsilon = norm_epsilon
self._kernel_regularizer = kernel_regularizer
self._bias_regularizer = bias_regularizer
self._output_intermediate_endpoints = output_intermediate_endpoints
if strides > 1:
if middle_dw_downsample and not middle_dw_kernel_size:
raise ValueError(
'Requested downsampling at a non-existing middle depthwise.'
)
if not middle_dw_downsample and not start_dw_kernel_size:
raise ValueError(
'Requested downsampling at a non-existing starting depthwise.'
)
if use_sync_bn:
self._norm = tf_keras.layers.experimental.SyncBatchNormalization
else:
self._norm = tf_keras.layers.BatchNormalization
if tf_keras.backend.image_data_format() == 'channels_last':
self._bn_axis = -1
else:
self._bn_axis = 1
if not depthwise_activation:
self._depthwise_activation = activation
if regularize_depthwise:View on GitHub (pinned to e006f5f0d5)
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.
When it happens
Trigger: Thrown at official/vision/modeling/layers/nn_blocks.py:893 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/df1328eec3e5bab2.
Report an issue: GitHub.