{"record":{"id":"62e0373d418bf366","repo":"tensorflow/models","slug":"input-offset-is-larger-than-num-feats","errorCode":null,"errorMessage":"input_offset ({}) is larger than num feats({})","messagePattern":"input_offset \\((.+?)\\) is larger than num feats\\((.+?)\\)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/modeling/decoders/nasfpn.py","lineNumber":261,"sourceCode":"      }\n\n  def _global_attention(self, feat0, feat1):\n    m = tf.math.reduce_max(feat0, axis=[1, 2], keepdims=True)\n    m = tf.math.sigmoid(m)\n    return feat0 + feat1 * m\n\n  def _build_feature_pyramid(self, feats):\n    num_output_connections = [0] * len(feats)\n    num_output_levels = self._max_level - self._min_level + 1\n    feat_levels = list(range(self._min_level, self._max_level + 1))\n\n    for i, block_spec in enumerate(self._block_specs):\n      new_level = block_spec.level\n\n      # Checks the range of input_offsets.\n      for input_offset in block_spec.input_offsets:\n        if input_offset >= len(feats):\n          raise ValueError(\n              'input_offset ({}) is larger than num feats({})'.format(\n                  input_offset, len(feats)))\n      input0 = block_spec.input_offsets[0]\n      input1 = block_spec.input_offsets[1]\n\n      # Update graph with inputs.\n      node0 = feats[input0]\n      node0_level = feat_levels[input0]\n      num_output_connections[input0] += 1\n      node0 = self._resample_feature_map(node0, node0_level, new_level)\n      node1 = feats[input1]\n      node1_level = feat_levels[input1]\n      num_output_connections[input1] += 1\n      node1 = self._resample_feature_map(node1, node1_level, new_level)\n\n      # Combine node0 and node1 to create new feat.\n      if block_spec.combine_fn == 'sum':\n        new_node = node0 + node1","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/modeling/decoders/nasfpn.py#L243-L279","documentation":"Error \"input_offset ({}) is larger than num feats({})\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/modeling/decoders/nasfpn.py:261 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set input_offset to a value smaller than the number of feature maps passed to the NASFPN layer.","Pass all backbone feature levels so the configured offsets are valid."],"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"}