TextVectorization
layer expects input with either a 1D tensor or a last dimension of 1, but the input tensor has the shape (None, None)
, that means it has two undefined dimensions. Make sure your input is a 1D tensor (batch_size,)
or reshape it so the last dimension is 1
.
Also, verify that your dataset pipeline correctly provides raw text data instead of improperly shaped tensors.
Hope it helps! Feel free to ask if you need further assistance.
is your issue resolved?
yes
please let learners know where was the mistake and how you resolved your issue, so other learners find your post helpful when encountering similar issue
thanks. solved the issue
You’re welcome! happy to help
I have the same issue. I can’t understand what @Alireza_Saei tried to explain. I would like to know how @Ayush_Sharma10 resolved his problem.
you need to create your own new topic even if you find similar error post, you can always tag related post link in your post. You also need to post screenshot of the error you have encountered.
What @Alireza_Saei explained which is actually explained in the raise error section. it is pointing towards how inputs is being defined.
The code where it might need attention based on post creator error screenshot is
Define both inputs. Remember to call then ‘input_1’ and ‘input_2’ using the name
parameter.
Be mindful of the data type and size.
Instructions for this code line
tf.keras.layers.Input: it is used to instantiate a Keras tensor. Remember to set correctly the dimension and type of the input, which are batches of questions. For this, keep in mind that each question is a single string.
Input(input_shape,dtype=None,…)
input_shape: Shape tuple (not including the batch axis)
dtype: (optional) data type of the input
So if you notice the input shape, you need to mention it as 1D tensor or as error mentions rank 1, which is a shape tuple which is dimension of the input and datatype needs to be tf.string