Reputation: 333
I have a ragged tensor, and upon trying to create a model, and use model.fit(), I get an error:
TypeError: Failed to convert object of type <class 'tensorflow.python.ops.ragged.ragged_tensor.RaggedTensor'> to Tensor. Contents: tf.RaggedTensor(values=Tensor("Cast_1:0", shape=(None,), dtype=float32), row_splits=Tensor("RaggedFromVariant_1/RaggedTensorFromVariant:0", shape=(None,), dtype=int64)). Consider casting elements to a supported type.
Is this an issue with the shape of my data? Perhaps the data altogether? Maybe I need to use a sparse or dense tensor instead? Here is my full traceback error:
Upvotes: 9
Views: 12742
Reputation: 1729
Every RaggedTensor
has an associated to_tensor()
method, call that. Check your input data transformations, that is where the RaggedTensor is getting created. Some ops return RaggedTensor
.
Upvotes: 19