{"record":{"id":"c0a5f4f033d985ad","repo":"tensorflow/models","slug":"in-train-mode-padding-truncation-is-required","errorCode":null,"errorMessage":"In TRAIN mode, padding/truncation is required.","messagePattern":"In TRAIN mode, padding/truncation is required\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/unified_detector/data_loaders/universal_detection_parser.py","lineNumber":134,"sourceCode":"        operations.\n      randaug_prob: (autoaugment parameter) Probabilily of applying each\n        distortion operation.\n      use_cropping: Bool, whether to use random cropping and resizing in\n        training.\n      crop_min_scale: The minimum scale of a random crop.\n      crop_max_scale: The maximum scale of a random crop. If >1, it means the\n        images are downsampled.\n      crop_min_aspect: The minimum aspect ratio of a random crop.\n      crop_max_aspect: The maximum aspect ratio of a random crop.\n      is_shape_defined: Whether to define the static shapes for all features and\n        labels. This must be set to True in TPU training as it requires static\n        shapes for all tensors.\n      use_tpu: Whether the inputs are fed to a TPU device.\n      detection_unit: Whether word or line (or else) is regarded as an entity.\n        The instance masks will be at word or line level.\n    \"\"\"\n    if is_training and max_num_instance < 0:\n      raise ValueError('In TRAIN mode, padding/truncation is required.')\n\n    self._is_training = is_training\n    self._output_dimension = output_dimension\n    self._mask_dimension = (\n        mask_dimension if mask_dimension > 0 else output_dimension)\n    self._max_num_instance = max_num_instance\n    self._decoder = tf_example_decoder.TfExampleDecoder(\n        num_additional_channels=3, additional_class_names=['parent'])\n    self._use_color_distortion = use_color_distortion\n    self._rot90_probability = rot90_probability\n    self._randaug_mag = randaug_mag\n    self._randaug_std = randaug_std\n    self._randaug_layer = randaug_layer\n    self._randaug_prob = randaug_prob\n    self._use_cropping = use_cropping\n    self._crop_min_scale = crop_min_scale\n    self._crop_max_scale = crop_max_scale\n    self._crop_min_aspect = crop_min_aspect","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/unified_detector/data_loaders/universal_detection_parser.py#L116-L152","documentation":"Error \"In TRAIN mode, padding/truncation is required.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/unified_detector/data_loaders/universal_detection_parser.py:134 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"}