{"record":{"id":"585babe3050b3842","repo":"tensorflow/models","slug":"invalid-dtype-provided-supported-types","errorCode":null,"errorMessage":"Invalid DType provided. Supported types: {}","messagePattern":"Invalid DType provided\\. Supported types: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/legacy/image_classification/dataset_factory.py","lineNumber":230,"sourceCode":"\n    Returns:\n      A mapping from string representation of a dtype to the `tf.dtypes.DType`.\n\n    Raises:\n      ValueError if the config's dtype is not supported.\n\n    \"\"\"\n    dtype_map = {\n        'float32': tf.float32,\n        'bfloat16': tf.bfloat16,\n        'float16': tf.float16,\n        'fp32': tf.float32,\n        'bf16': tf.bfloat16,\n    }\n    try:\n      return dtype_map[self.config.dtype]\n    except:\n      raise ValueError('Invalid DType provided. Supported types: {}'.format(\n          dtype_map.keys()))\n\n  @property\n  def image_size(self) -> int:\n    \"\"\"The size of each image (can be inferred from the dataset).\"\"\"\n\n    if self.config.image_size == 'infer':\n      return self.info.features['image'].shape[0]\n    else:\n      return int(self.config.image_size)\n\n  @property\n  def num_channels(self) -> int:\n    \"\"\"The number of image channels (can be inferred from the dataset).\"\"\"\n    if self.config.num_channels == 'infer':\n      return self.info.features['image'].shape[-1]\n    else:\n      return int(self.config.num_channels)","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/legacy/image_classification/dataset_factory.py#L212-L248","documentation":"DType property guard in DatasetBuilder: config.dtype is not one of the supported keys (float32, bfloat16, float16, fp32, bf16). A bare except converts any lookup failure — including a non-string dtype value — into this ValueError.","triggerScenarios":"Thrown at official/legacy/image_classification/dataset_factory.py:230 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the config dtype to one of 'float32', 'bfloat16', 'float16', 'fp32', 'bf16'","Check the --dtype flag spelling (e.g. use 'fp32' not 'fp-32')"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}