{"record":{"id":"bc21bc673ed65e14","repo":"tensorflow/models","slug":"output-stride-must-be-none-1-or-a-multiple-of-2","errorCode":null,"errorMessage":"Output stride must be None, 1 or a multiple of 2.","messagePattern":"Output stride must be None, 1 or a multiple of 2\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/modeling/backbones/mobilenet.py","lineNumber":1302,"sourceCode":"        https://arxiv.org/abs/1801.04381.\n      output_intermediate_endpoints: A `bool` of whether or not output the\n        intermediate endpoints.\n      **kwargs: Additional keyword arguments to be passed.\n    \"\"\"\n    if model_id not in SUPPORTED_SPECS_MAP:\n      raise ValueError('The MobileNet version {} '\n                       'is not supported'.format(model_id))\n\n    if filter_size_scale <= 0:\n      raise ValueError('filter_size_scale is not greater than zero.')\n\n    if output_stride is not None:\n      if model_id == 'MobileNetV1':\n        if output_stride not in [8, 16, 32]:\n          raise ValueError('Only allowed output_stride values are 8, 16, 32.')\n      else:\n        if output_stride == 0 or (output_stride > 1 and output_stride % 2):\n          raise ValueError('Output stride must be None, 1 or a multiple of 2.')\n\n    self._model_id = model_id\n    self._input_specs = input_specs\n    self._filter_size_scale = filter_size_scale\n    self._min_depth = min_depth\n    self._output_stride = output_stride\n    self._divisible_by = divisible_by\n    self._stochastic_depth_drop_rate = stochastic_depth_drop_rate\n    self._flat_stochastic_depth_drop_rate = flat_stochastic_depth_drop_rate\n    self._regularize_depthwise = regularize_depthwise\n    self._kernel_initializer = kernel_initializer\n    self._kernel_regularizer = kernel_regularizer\n    self._bias_regularizer = bias_regularizer\n    self._use_sync_bn = use_sync_bn\n    self._norm_momentum = norm_momentum\n    self._norm_epsilon = norm_epsilon\n    self._finegrain_classification_mode = finegrain_classification_mode\n    self._output_intermediate_endpoints = output_intermediate_endpoints","sourceCodeStart":1284,"sourceCodeEnd":1320,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/modeling/backbones/mobilenet.py#L1284-L1320","documentation":"Error \"Output stride must be None, 1 or a multiple of 2.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/modeling/backbones/mobilenet.py:1302 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set output_stride to None, 1, or a multiple of 2.","Fix the output_stride value in the backbone config to satisfy the constraint."],"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"}