{"record":{"id":"7aa1833bf2c666b7","repo":"tensorflow/models","slug":"translate-y-only-bboxes-does-not-support-rank-4-bo","errorCode":null,"errorMessage":"translate_y_only_bboxes does not support rank 4 boxes","messagePattern":"translate_y_only_bboxes does not support rank 4 boxes","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/ops/augment.py","lineNumber":1642,"sourceCode":"  else:\n    image = translate_y(image, pixels, replace)\n\n  # Convert bbox coordinates to pixel values.\n  image_height = tf.shape(image)[0]\n  image_width = tf.shape(image)[1]\n  # pylint:disable=g-long-lambda\n  wrapped_shift_bbox = lambda bbox: _shift_bbox(\n      bbox, image_height, image_width, pixels, shift_horizontal)\n  # pylint:enable=g-long-lambda\n  bboxes = tf.map_fn(wrapped_shift_bbox, bboxes)\n  return image, bboxes\n\n\ndef translate_y_only_bboxes(\n    image: tf.Tensor, bboxes: tf.Tensor, prob: float, pixels: int, replace):\n  \"\"\"Apply translate_y to each bbox in the image with probability prob.\"\"\"\n  if bboxes.shape.rank == 4:\n    raise ValueError('translate_y_only_bboxes does not support rank 4 boxes')\n\n  func_changes_bbox = False\n  prob = _scale_bbox_only_op_probability(prob)\n  return _apply_multi_bbox_augmentation_wrapper(\n      image, bboxes, prob, translate_y, func_changes_bbox, pixels, replace)\n\n\ndef _randomly_negate_tensor(tensor):\n  \"\"\"With 50% prob turn the tensor negative.\"\"\"\n  should_flip = tf.cast(tf.floor(tf.random.uniform([]) + 0.5), tf.bool)\n  final_tensor = tf.cond(should_flip, lambda: tensor, lambda: -tensor)\n  return final_tensor\n\n\ndef _rotate_level_to_arg(level: float):\n  level = (level / _MAX_LEVEL) * 30.\n  level = _randomly_negate_tensor(level)\n  return (level,)","sourceCodeStart":1624,"sourceCodeEnd":1660,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/ops/augment.py#L1624-L1660","documentation":"Error \"translate_y_only_bboxes does not support rank 4 boxes\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/ops/augment.py:1642 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass boxes as rank 3 or lower; rank-4 batched boxes are not supported here.","Reshape boxes to [num_boxes, 4] before calling this augmentation."],"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"}