{"record":{"id":"4b9a10419da4838e","repo":"tensorflow/models","slug":"input-should-be-a-tf-tensor-or-a-sequence-of-tf-te","errorCode":null,"errorMessage":"Input should be a tf.Tensor or a sequence of tf.Tensor, not {}.","messagePattern":"Input should be a tf\\.Tensor or a sequence of tf\\.Tensor, not (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/modeling/retinanet_model.py","lineNumber":164,"sourceCode":"\n    if training:\n      if raw_attributes:\n        outputs.update({'attribute_outputs': raw_attributes})\n      return outputs\n    else:\n      if self._anchor_boxes is not None:\n        batch_size = tf.shape(raw_boxes[str(self._config_dict['min_level'])])[0]\n        anchor_boxes = collections.OrderedDict()\n        for level, boxes in self._anchor_boxes.items():\n          anchor_boxes[level] = tf.tile(boxes[None, ...], [batch_size, 1, 1, 1])\n      elif anchor_boxes is None:\n        # Generate anchor boxes for this batch if not provided.\n        if isinstance(images, Sequence):\n          primary_images = images[0]\n        elif isinstance(images, tf.Tensor):\n          primary_images = images\n        else:\n          raise ValueError(\n              'Input should be a tf.Tensor or a sequence of tf.Tensor, not {}.'\n              .format(type(images)))\n\n        _, image_height, image_width, _ = primary_images.get_shape().as_list()\n        anchor_boxes = anchor.Anchor(\n            min_level=self._config_dict['min_level'],\n            max_level=self._config_dict['max_level'],\n            num_scales=self._config_dict['num_scales'],\n            aspect_ratios=self._config_dict['aspect_ratios'],\n            anchor_size=self._config_dict['anchor_size'],\n            image_size=(image_height, image_width)).multilevel_boxes\n        for l in anchor_boxes:\n          anchor_boxes[l] = tf.tile(\n              tf.expand_dims(anchor_boxes[l], axis=0),\n              [tf.shape(primary_images)[0], 1, 1, 1])\n\n      # Post-processing.\n      final_results = self.detection_generator(raw_boxes, raw_scores,","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/modeling/retinanet_model.py#L146-L182","documentation":"Error \"Input should be a tf.Tensor or a sequence of tf.Tensor, not {}.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/modeling/retinanet_model.py:164 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a tf.Tensor or a list/tuple of tf.Tensor as model input.","Convert numpy arrays or other types to tf.Tensor before calling the model."],"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"}