{"record":{"id":"b0cecb0bd08bf0f5","repo":"tensorflow/models","slug":"input-must-be-of-size-height-width-c-0-b0cecb","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/resnet/imagenet_preprocessing.py","lineNumber":452,"sourceCode":"    image = _mean_image_subtraction(image, means)\n\n  Note that the rank of `image` must be known.\n\n  Args:\n    image: 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\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.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))\n\n  return image - means\n\n\ndef _smallest_size_at_least(height, width, resize_min):\n  \"\"\"Computes new shape with the smallest side equal to `smallest_side`.\n\n  Computes new shape with the smallest side equal to `smallest_side` while\n  preserving the original aspect ratio.\n","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/legacy/image_classification/resnet/imagenet_preprocessing.py#L434-L470","documentation":"Error \"Input must be of size [height, width, C>0]\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/legacy/image_classification/resnet/imagenet_preprocessing.py:452 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"}