{"record":{"id":"ffa490e6893f4c90","repo":"tensorflow/models","slug":"expected-the-row-indices-tensor-output-h-has-ran","errorCode":null,"errorMessage":"Expected the row_indices tensor (output_h) has rank == 1, was: %s","messagePattern":"Expected the row_indices tensor \\(output_h\\) has rank == 1, was: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/ops/spatial_transform_ops.py","lineNumber":583,"sourceCode":"\n  Args:\n    input_matrix: A 2-D tensor in shape (input_h, input_w) from which to gather\n      values. The shape must be 2-D, since sparse matrix multiplication is\n      currently only supported on 2-D matrices.\n    row_indices: A 1-D int tensor in shape (output_h) which stored the row\n      indices of the input.\n\n  Returns:\n    A tensor in shape (output_h, input_w) which stores the gathered rows.\n  \"\"\"\n  input_matrix_shape = input_matrix.get_shape().as_list()\n  if len(input_matrix_shape) != 2:\n    raise ValueError(\n        'Expected the input_matrix tensor (input_h, input_w) has rank == 2, '\n        'was: %s' % input_matrix_shape)\n  row_indices_shape = row_indices.get_shape().as_list()\n  if len(row_indices_shape) != 1:\n    raise ValueError(\n        'Expected the row_indices tensor (output_h) has rank == 1, was: %s' %\n        row_indices_shape)\n\n  # (output_h, input_h)\n  indices_one_hot = tf.one_hot(\n      row_indices, depth=input_matrix_shape[0], dtype=input_matrix.dtype)\n  # Matrix multiplication: (output_h, input_h) x (input_h, input_w)\n  # (output_h, input_w)\n  return tf.linalg.matmul(indices_one_hot, input_matrix, a_is_sparse=True)\n\n\ndef bilinear_resize_to_bbox(\n    images: tf.Tensor, bbox: tf.Tensor, output_size: tf.Tensor\n) -> tf.Tensor:\n  \"\"\"Bilinear resizes the images to fit into the bounding boxes in the output.\n\n  Args:\n    images: A tensor in shape (batch_size, input_h, input_w, ...) with arbitrary","sourceCodeStart":565,"sourceCodeEnd":601,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/ops/spatial_transform_ops.py#L565-L601","documentation":"Error \"Expected the row_indices tensor (output_h) has rank == 1, was: %s\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/ops/spatial_transform_ops.py:583 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass row_indices as a rank-1 tensor of shape (output_h,).","Flatten the row_indices tensor to 1-D."],"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"}