{"record":{"id":"254c66631675cc85","repo":"tensorflow/models","slug":"input-must-be-of-size-height-width-c-0","errorCode":null,"errorMessage":"Input must be of size [height, width, C>0]","messagePattern":"Input must be of size \\[height, width, C>0\\]","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/legacy/image_classification/preprocessing.py","lineNumber":62,"sourceCode":"\n  Note that the rank of `image` must be known.\n\n  Args:\n    image_bytes: a tensor of size [height, width, C].\n    means: a C-vector of values to subtract from each channel.\n    num_channels: number of color channels in the image that will be distorted.\n    dtype: the dtype to convert the images to. Set to `None` to skip conversion.\n\n  Returns:\n    the centered image.\n\n  Raises:\n    ValueError: If the rank of `image` is unknown, if `image` has a rank other\n      than three or if the number of channels in `image` doesn't match the\n      number of values in `means`.\n  \"\"\"\n  if image_bytes.get_shape().ndims != 3:\n    raise ValueError('Input must be of size [height, width, C>0]')\n\n  if len(means) != num_channels:\n    raise ValueError('len(means) must match the number of channels')\n\n  # We have a 1-D tensor of means; convert to 3-D.\n  # Note(b/130245863): we explicitly call `broadcast` instead of simply\n  # expanding dimensions for better performance.\n  means = tf.broadcast_to(means, tf.shape(image_bytes))\n  if dtype is not None:\n    means = tf.cast(means, dtype=dtype)\n\n  return image_bytes - means\n\n\ndef standardize_image(\n    image_bytes: tf.Tensor,\n    stddev: Tuple[float, ...],\n    num_channels: int = 3,","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/legacy/image_classification/preprocessing.py#L44-L80","documentation":"Error \"Input must be of size [height, width, C>0]\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/legacy/image_classification/preprocessing.py:62 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"}