KerasTensor is symbolic

ValueError: Exception encountered when calling layer ‘preprocessing’ (type KerasLayer).
A KerasTensor is symbolic: it’s a placeholder for a shape an a dtype. It doesn’t have any actual numerical value. You cannot convert it to a NumPy array.
Call arguments received by layer ‘preprocessing’ (type KerasLayer):
• inputs=
• training=None

Hi @Aarushi_Vadhavkar, Could you please provide the sample code to reproduce the issue. Thank You.

import tensorflow_hub as hub

import tensorflow_text as text

import tensorflow as tf

preprocessor = hub.KerasLayer(“TensorFlow | bert | Kaggle”)

encoder = hub.KerasLayer(“TensorFlow | bert | Kaggle”)

text_input = tf.keras.layers.Input(shape=(), dtype=tf.string, name=‘text’)

preprocessed_text = preprocessor(text_input)

outputs = encoder(preprocessed_text)

l = tf.keras.layers.Dropout(0.1, name=“dropout”)(outputs[‘pooled_output’])

l = tf.keras.layers.Dense(1, activation=‘sigmoid’, name=“output”)(l)

model = tf.keras.Model(inputs=[text_input], outputs = [l])
model.summary()

1 Like