{"record":{"id":"2a9725a9ebd54ad1","repo":"tensorflow/models","slug":"more-than-one-maxpool-should-be-specified-in-spp-b","errorCode":null,"errorMessage":"More than one maxpool should be specified in SPP block","messagePattern":"More than one maxpool should be specified in SPP block","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/yolo/modeling/layers/nn_blocks.py","lineNumber":1136,"sourceCode":"\n  def call(self, inputs, training=None):\n    # done this way to prevent confusion in the auto graph\n    if self._inverted:\n      return self._call_reversed(inputs, training=training)\n    else:\n      return self._call_regular(inputs, training=training)\n\n\nclass SPP(tf_keras.layers.Layer):\n  \"\"\"Spatial Pyramid Pooling.\n\n  A non-agregated SPP layer that uses Pooling.\n  \"\"\"\n\n  def __init__(self, sizes, **kwargs):\n    self._sizes = list(reversed(sizes))\n    if not sizes:\n      raise ValueError('More than one maxpool should be specified in SPP block')\n    super().__init__(**kwargs)\n\n  def build(self, input_shape):\n    maxpools = []\n    for size in self._sizes:\n      maxpools.append(\n          tf_keras.layers.MaxPool2D(\n              pool_size=(size, size),\n              strides=(1, 1),\n              padding='same',\n              data_format=None))\n    self._maxpools = maxpools\n    super().build(input_shape)\n\n  def call(self, inputs, training=None):\n    outputs = []\n    for maxpool in self._maxpools:\n      outputs.append(maxpool(inputs))","sourceCodeStart":1118,"sourceCodeEnd":1154,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/yolo/modeling/layers/nn_blocks.py#L1118-L1154","documentation":"Truthiness guard in SPP.__init__: the sizes argument (max-pooling kernel sizes for the Spatial Pyramid Pooling branches) is empty. An SPP layer with zero pooling branches is degenerate — it produces no multi-scale context — so construction is rejected. The message wording is itself buggy ('More than one' though the check requires at least one), but the remedy is the same: supply at least one pool size.","triggerScenarios":"Thrown at official/projects/yolo/modeling/layers/nn_blocks.py:1136 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a non-empty list of pool sizes, e.g. SPP(sizes=[1, 5, 9, 13])","Check config plumbing if sizes arrives empty from YAML (a missing key defaulting to [])","Omit the SPP layer entirely if no pooling branches are wanted"],"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"}