{"record":{"id":"018fef50457a48e9","repo":"tensorflow/models","slug":"boxes-shape-boxes-shape-and-scores-shape-sco","errorCode":null,"errorMessage":"Boxes shape ({boxes.shape}) and scores shape ({scores.shape}) do not match.","messagePattern":"Boxes shape \\((.+?)\\) and scores shape \\((.+?)\\) do not match\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/modeling/layers/edgetpu.py","lineNumber":296,"sourceCode":"    scores: A 1-D+ float `Tensor` of shape `[...batch_dims, num_boxes]`\n      representing a single score corresponding to each box (each row of boxes).\n    output_size: A scalar integer `Tensor` representing the maximum number of\n      boxes to be selected by non-max suppression.\n    iou_threshold: A 0-D float tensor representing the threshold for deciding\n      whether boxes overlap too much with respect to IOU.\n    refinements: A number of extra refinement steps to make result closer to\n      original sequencial NMS.\n\n  Returns:\n    A 1-D+ integer `Tensor` of shape `[...batch_dims, output_size]` representing\n    the selected indices from the boxes tensor and `-1` values for the padding.\n  \"\"\"\n  boxes_size = boxes.shape[-2]\n  if boxes.shape[-1] != 4:\n    raise ValueError(f'Boxes shape ({boxes.shape}) last dimension must be 4 '\n                     'to represent [y1, x1, y2, x2] boxes coordinates')\n  if scores.shape != boxes.shape[:-1]:\n    raise ValueError(f'Boxes shape ({boxes.shape}) and scores shape '\n                     f'({scores.shape}) do not match.')\n  order = tf.constant(np.arange(boxes_size), dtype=scores.dtype)\n  relative_order = _tensor_sum_vectors(order, -order)\n  relative_scores = _tensor_sum_vectors(scores, -scores)\n  similar = tf.cast(\n      _greater(\n          _tensor_product_iou(boxes) -\n          tf.constant(iou_threshold, dtype=boxes.dtype)), scores.dtype)\n  worse = _greater(relative_scores)\n  same_later = _and(_same(relative_scores), _greater(relative_order))\n  similar_worse_or_same_later = _and(similar, _or(worse, same_later))\n  for _ in range(refinements):\n    similar_worse_or_same_later = _refine_nms_graph_to_original_algorithm(\n        similar_worse_or_same_later)\n  prunable = _reduce_or(similar_worse_or_same_later, axis=-1)\n  remaining = tf.constant(1, dtype=prunable.dtype) - prunable\n  if scores.shape[0] is None:\n    # Prefer the most of tesnor shape defined, so that error messages are clear.","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/modeling/layers/edgetpu.py#L278-L314","documentation":"Error \"Boxes shape ({boxes.shape}) and scores shape ({scores.shape}) do not match.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/modeling/layers/edgetpu.py:296 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Make boxes and scores have matching batch and box-count dimensions.","Ensure both tensors come from the same detection outputs so their leading dimensions agree."],"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"}