{"record":{"id":"ee2c94716571b194","repo":"tensorflow/models","slug":"invalid-tensor-type-should-be-tf-float32","errorCode":null,"errorMessage":"Invalid tensor type: should be tf.float32","messagePattern":"Invalid tensor type: should be tf\\.float32","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"official/projects/centernet/ops/box_list.py","lineNumber":71,"sourceCode":"\nclass BoxList(object):\n  \"\"\"Box collection.\"\"\"\n\n  def __init__(self, boxes):\n    \"\"\"Constructs box collection.\n\n    Args:\n      boxes: a tensor of shape [N, 4] representing box corners\n\n    Raises:\n      ValueError: if invalid dimensions for bbox data or if bbox data is not in\n          float32 format.\n    \"\"\"\n    if len(boxes.get_shape()) != 2 or boxes.get_shape()[-1] != 4:\n      raise ValueError('Invalid dimensions for box data: {}'.format(\n          boxes.shape))\n    if boxes.dtype != tf.float32:\n      raise ValueError('Invalid tensor type: should be tf.float32')\n    self.data = {'boxes': boxes}\n\n  def num_boxes(self):\n    \"\"\"Returns number of boxes held in collection.\n\n    Returns:\n      a tensor representing the number of boxes held in the collection.\n    \"\"\"\n    return tf.shape(self.data['boxes'])[0]\n\n  def num_boxes_static(self):\n    \"\"\"Returns number of boxes held in collection.\n\n    This number is inferred at graph construction time rather than run-time.\n\n    Returns:\n      Number of boxes held in collection (integer) or None if this is not\n        inferrable at graph construction time.","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/centernet/ops/box_list.py#L53-L89","documentation":"Error \"Invalid tensor type: should be tf.float32\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/centernet/ops/box_list.py:71 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"}