tensorflow/models · error · TypeError
Got unsupported tensor type for feature {feature_name}. The
Error message
Got unsupported tensor type for feature {feature_name}. The feature tensor must be one of `tf.Tensor`, `tf.SparseTensor` or `tf.RaggedTensor`, but got {feature} instead. What it means
Error "Got unsupported tensor type for feature {feature_name}. The feature tensor must be one of `tf.Tensor`, `tf.SparseTensor` or `tf.RaggedTensor`, but got {feature} instead." thrown in tensorflow/models.
Source
Thrown at official/recommendation/uplift/layers/encoders/concat_features.py:102
" same shape except for the last dimension, but got features with"
f" incompatible shapes {feature_shapes}"
)
super().build(input_shapes)
def call(self, inputs: types.DictOfTensors) -> tf.Tensor:
features = []
for feature_name, feature in inputs.items():
if feature_name in self._feature_names:
if isinstance(feature, tf.Tensor):
features.append(feature)
elif isinstance(feature, tf.SparseTensor):
features.append(tf.sparse.to_dense(feature))
elif isinstance(feature, tf.RaggedTensor):
features.append(feature.to_tensor())
else:
raise TypeError(
f"Got unsupported tensor type for feature {feature_name}. The"
" feature tensor must be one of `tf.Tensor`, `tf.SparseTensor` or"
f" `tf.RaggedTensor`, but got {feature} instead."
)
return tf.concat(features, axis=-1)
def get_config(self):
config = super().get_config()
config.update({"feature_names": self._feature_names})
return config
View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/recommendation/uplift/layers/encoders/concat_features.py:102 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/5e09200ac015bd69.
Report an issue: GitHub.