{"record":{"id":"8f05bd861a057a4e","repo":"tensorflow/models","slug":"for-the-tensor-s-the-actual-tensor-rank-d-8f05bd","errorCode":null,"errorMessage":"For the tensor `%s`, the actual tensor rank `%d` (shape = %s) is not equal to the expected tensor rank `%s`","messagePattern":"For the tensor `(.+?)`, the actual tensor rank `(.+?)` \\(shape = (.+?)\\) is not equal to the expected tensor rank `(.+?)`","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/detr/ops/matchers.py","lineNumber":444,"sourceCode":"\n  Args:\n    tensor: A tf.Tensor to check the rank of.\n    expected_rank: Python integer or list of integers, expected rank.\n    name: Optional name of the tensor for the error message.\n\n  Raises:\n    ValueError: If the expected shape doesn't match the actual shape.\n  \"\"\"\n  expected_rank_dict = {}\n  if isinstance(expected_rank, int):\n    expected_rank_dict[expected_rank] = True\n  else:\n    for x in expected_rank:\n      expected_rank_dict[x] = True\n\n  actual_rank = len(tensor.shape)\n  if actual_rank not in expected_rank_dict:\n    raise ValueError(\n        \"For the tensor `%s`, the actual tensor rank `%d` (shape = %s) is not \"\n        \"equal to the expected tensor rank `%s`\" %\n        (name, actual_rank, str(tensor.shape), str(expected_rank)))\n\n\ndef hungarian_matching(weights):\n  \"\"\"Computes the minimum linear sum assignment using the Hungarian algorithm.\n\n  Args:\n    weights: A float32 [batch_size, num_elems, num_elems] tensor, where each\n      inner matrix represents weights to be use for matching.\n\n  Returns:\n    A bool [batch_size, num_elems, num_elems] tensor, where each element of the\n    inner matrix represents whether the worker has been matched to the job.\n    The returned matching will always be a perfect match.\n  \"\"\"\n  batch_size, num_elems, _ = tf_utils.get_shape_list(weights, 3)","sourceCodeStart":426,"sourceCodeEnd":462,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/detr/ops/matchers.py#L426-L462","documentation":"Error \"For the tensor `%s`, the actual tensor rank `%d` (shape = %s) is not equal to the expected tensor rank `%s`\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/detr/ops/matchers.py:444 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"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"}