# KerasTensor is symbolic

**URL:** <https://discuss.ai.google.dev/t/kerastensor-is-symbolic/41024>\
**Category:** TensorFlow\
**Tags:** tfkeras\
**Created:** [September 30, 2024, 5:50am UTC](https://discuss.ai.google.dev/t/kerastensor-is-symbolic/41024 "2024-09-30T05:50:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aarushi\_Vadhavkar](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/aarushi_vadhavkar/32/23529_2.png) [@Aarushi\_Vadhavkar](https://discuss.ai.google.dev/u/Aarushi_Vadhavkar)\
**Post date:** [September 30, 2024, 5:50am UTC](https://discuss.ai.google.dev/t/kerastensor-is-symbolic/41024/1 "2024-09-30T05:50:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kiran\_Sai\_Ramineni](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/kiran_sai_ramineni/32/8859_2.png) [@Kiran\_Sai\_Ramineni](https://discuss.ai.google.dev/u/Kiran_Sai_Ramineni)\
**Post date:** [September 30, 2024, 8:51am UTC](https://discuss.ai.google.dev/t/kerastensor-is-symbolic/41024/2 "2024-09-30T08:51:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dileepa](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/dileepa/32/36055_2.png) [@dileepa](https://discuss.ai.google.dev/u/dileepa)\
**Post date:** [December 31, 2024, 1:10pm UTC](https://discuss.ai.google.dev/t/kerastensor-is-symbolic/41024/4 "2024-12-31T13:10:34Z")

</div>

import tensorflow\_hub as hub

import tensorflow\_text as text

import tensorflow as tf

preprocessor = hub.KerasLayer(“[TensorFlow | bert | Kaggle](https://kaggle.com/models/tensorflow/bert/TensorFlow2/en-uncased-preprocess/3)”)

encoder = hub.KerasLayer(“[TensorFlow | bert | Kaggle](https://www.kaggle.com/models/tensorflow/bert/TensorFlow2/bert-en-uncased-l-10-h-768-a-12/2)”)

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()
