{"record":{"id":"d8786e4b9272bc40","repo":"tensorflow/models","slug":"only-channels-last-mode-is-supported","errorCode":null,"errorMessage":"Only \"channels_last\" mode is supported","messagePattern":"Only \"channels_last\" mode is supported","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/pointpillars/utils/utils.py","lineNumber":35,"sourceCode":"import collections\nfrom typing import Any, List, Mapping, Tuple\n\nimport numpy as np\nimport tensorflow as tf, tf_keras\n\n\nCLASSES = {'vehicle': 1, 'pedestrian': 2, 'cyclist': 3}\n\n\ndef assert_shape(x: np.ndarray, shape: List[int]):\n  if tuple(x.shape) != tuple(shape):\n    raise ValueError('Shape of array should be {}, but {} found'.format(\n        shape, x.shape))\n\n\ndef assert_channels_last():\n  if tf_keras.backend.image_data_format() != 'channels_last':\n    raise ValueError('Only \"channels_last\" mode is supported')\n\n\ndef pad_or_trim_to_shape(x: np.ndarray, shape: List[int]) -> np.ndarray:\n  \"\"\"Pad and trim x to the specified shape, x should have same rank as shape.\n\n  Args:\n    x: An np array.\n    shape: A list of int indicating a array shape.\n\n  Returns:\n    y: An np array with padded/trimmed shape.\n  \"\"\"\n  shape = np.array(shape)  # pyrefly: ignore[bad-assignment]\n\n  # Try to pad from end\n  pad_end = shape - np.minimum(x.shape, shape)\n  pad_begin = np.zeros_like(pad_end)\n  padder = np.stack([pad_begin, pad_end], axis=1)","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/pointpillars/utils/utils.py#L17-L53","documentation":"Error \"Only \"channels_last\" mode is supported\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/pointpillars/utils/utils.py:35 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"}