{"record":{"id":"8f66c9966efd6365","repo":"tensorflow/models","slug":"all-features-from-the-feature-names-set-must-be-te","errorCode":null,"errorMessage":"All features from the feature_names set must be tensors with the same shape except for the last dimension, but got features with incompatible shapes {feature_shapes}","messagePattern":"All features from the feature_names set must be tensors with the same shape except for the last dimension, but got features with incompatible shapes (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/recommendation/uplift/layers/encoders/concat_features.py","lineNumber":82,"sourceCode":"        if feature_name in self._feature_names\n    }\n\n    most_specific_shape = tf.TensorShape(None)\n    for feature_name, shape in feature_shapes.items():\n      if not isinstance(shape, tf.TensorShape):\n        raise TypeError(\n            f\"Got unsupported tensor shape type for feature {feature_name}. The\"\n            \" feature tensor must be one of `tf.Tensor`, `tf.SparseTensor` or\"\n            \" `tf.RaggedTensor`, with a well defined tensor shape but got shape\"\n            f\" {shape} instead.\"\n        )\n\n      shape = shape[:-1]\n      if shape.is_subtype_of(most_specific_shape):\n        most_specific_shape = shape\n\n      elif not most_specific_shape.is_subtype_of(shape):\n        raise ValueError(\n            \"All features from the feature_names set must be tensors with the\"\n            \" same shape except for the last dimension, but got features with\"\n            f\" incompatible shapes {feature_shapes}\"\n        )\n\n    super().build(input_shapes)\n\n  def call(self, inputs: types.DictOfTensors) -> tf.Tensor:\n    features = []\n\n    for feature_name, feature in inputs.items():\n      if feature_name in self._feature_names:\n        if isinstance(feature, tf.Tensor):\n          features.append(feature)\n        elif isinstance(feature, tf.SparseTensor):\n          features.append(tf.sparse.to_dense(feature))\n        elif isinstance(feature, tf.RaggedTensor):\n          features.append(feature.to_tensor())","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/recommendation/uplift/layers/encoders/concat_features.py#L64-L100","documentation":"Error \"All features from the feature_names set must be tensors with the same shape except for the last dimension, but got features with incompatible shapes {feature_shapes}\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/recommendation/uplift/layers/encoders/concat_features.py:82 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"}