keras
keras copied to clipboard
StringLookup Layer not working with sequences when output mode is one-hot
I am reviving this error when trying to use the 'one-hot' output mode on a string lookup layer.
When output_mode is not 'int', maximum supported output rank is 2. Received output_mode one_hot and input shape (None, 30), which would result in output rank 3.
I am trying to input a sequence of strings using a tf.data.Dataset
. The length of the sequence is 30. Here is what the element spec looks like for my dataset object.
((TensorSpec(shape=(None, 30, 25), dtype=tf.float64, name=None), TensorSpec(shape=(None, 30), dtype=tf.string, name=None), TensorSpec(shape=(None, 30), dtype=tf.string, name=None), TensorSpec(shape=(None, 30), dtype=tf.int32, name=None), TensorSpec(shape=(None, 30), dtype=tf.string, name=None), TensorSpec(shape=(None, 30), dtype=tf.int32, name=None), TensorSpec(shape=(None, 30), dtype=tf.string, name=None), TensorSpec(shape=(None, 30), dtype=tf.string, name=None), TensorSpec(shape=(None, 30), dtype=tf.string, name=None), TensorSpec(shape=(None, 28), dtype=tf.float64, name=None), TensorSpec(shape=(None,), dtype=tf.string, name=None), TensorSpec(shape=(None,), dtype=tf.string, name=None), TensorSpec(shape=(None,), dtype=tf.string, name=None), TensorSpec(shape=(None,), dtype=tf.string, name=None)), TensorSpec(shape=(None,), dtype=tf.int32, name=None))
I the StringLookup layer is being passed as the first layer in my model. It seems like the batch dimension is being taken into account in the rank calculation, which is causing my model to fail. I also notice this comment in the code. Is this still on the docket to remove this rank restriction?