# Keras

**URL:** https://discuss.ai.google.dev/c/keras/22.md?page=2

[Latest](https://discuss.ai.google.dev/latest.md) · [Categories](https://discuss.ai.google.dev/categories.md) · [Tags](https://discuss.ai.google.dev/tags.md)

**Page:** 3

---

## [InvalidArgumentError: Graph execution error: (NLP)](https://discuss.ai.google.dev/t/invalidargumenterror-graph-execution-error-nlp/51251)

<div class="topic-metadata">

**Author:** [@Shubham\_Sojitra](https://discuss.ai.google.dev/u/Shubham_Sojitra)\
**Replies:** 1\
**Last updated:** [November 25, 2024, 5:46am UTC](https://discuss.ai.google.dev/t/invalidargumenterror-graph-execution-error-nlp/51251 "2024-11-25T05:46:19Z")

</div>

I have used this code for Compile and Train the Model. But I am facing “Graph execution error”. Can someone help with this i don’t know how to fix this I tried solve this this but nothing is working. def simple\_rnn(inpu…

---

## [Upcoming Meetups or forums events](https://discuss.ai.google.dev/t/upcoming-meetups-or-forums-events/48425)

<div class="topic-metadata">

**Author:** [@raman](https://discuss.ai.google.dev/u/raman)\
**Replies:** 1\
**Last updated:** [November 18, 2024, 5:02am UTC](https://discuss.ai.google.dev/t/upcoming-meetups-or-forums-events/48425 "2024-11-18T05:02:57Z")

</div>

Hi I am recently joined the community any upcoming Meetups .

---

## [Building an RNN with LSTM and after Padding and Masking I am getting a Failed to Convert Elements to Tensor Error](https://discuss.ai.google.dev/t/building-an-rnn-with-lstm-and-after-padding-and-masking-i-am-getting-a-failed-to-convert-elements-to-tensor-error/33919)

<div class="topic-metadata">

**Author:** [@Richard\_Garcia](https://discuss.ai.google.dev/u/Richard_Garcia)\
**Replies:** 1\
**Last updated:** [November 15, 2024, 9:11am UTC](https://discuss.ai.google.dev/t/building-an-rnn-with-lstm-and-after-padding-and-masking-i-am-getting-a-failed-to-convert-elements-to-tensor-error/33919 "2024-11-15T09:11:09Z")

</div>

Hello I am currently building an RNN model that utilizes RNN. I have two embedded layers. I have padded my sequences with a custom value and I am trying to mask those sequences in the model creation. When I call model.fi…

---

## [Use 1D array from Keras Input as index for a list](https://discuss.ai.google.dev/t/use-1d-array-from-keras-input-as-index-for-a-list/31115)

<div class="topic-metadata">

**Author:** [@acraev](https://discuss.ai.google.dev/u/acraev)\
**Replies:** 1\
**Last updated:** [November 13, 2024, 5:30pm UTC](https://discuss.ai.google.dev/t/use-1d-array-from-keras-input-as-index-for-a-list/31115 "2024-11-13T17:30:10Z")

</div>

I have the following list of Encoders: fam\_specific\_enc = \[ Encoder(num\_layers=1, num\_heads=num\_heads\_enc, hidden\_dim=dense\_dim\_enc/2, dropout\_rate=drop\_enc, name=f"…

---

## [ValueError: Shapes (None, 775, 770, 1) and (None, 776, 776, 8) are incompatible](https://discuss.ai.google.dev/t/valueerror-shapes-none-775-770-1-and-none-776-776-8-are-incompatible/32082)

<div class="topic-metadata">

**Author:** [@Bryan\_Brad](https://discuss.ai.google.dev/u/Bryan_Brad)\
**Replies:** 1\
**Last updated:** [November 8, 2024, 10:46am UTC](https://discuss.ai.google.dev/t/valueerror-shapes-none-775-770-1-and-none-776-776-8-are-incompatible/32082 "2024-11-08T10:46:21Z")

</div>

I trying to replicate the semantic segmentation example but train on my own data. There are 8 labels (7 features + background). My images are 775 by 770 pixels. I changed num\_classes to 8, img\_size to (775,770) (and c…

---

## [JIT compile set to false in compile function and set to true globally](https://discuss.ai.google.dev/t/jit-compile-set-to-false-in-compile-function-and-set-to-true-globally/30974)

<div class="topic-metadata">

**Author:** [@MLEnthusiastic](https://discuss.ai.google.dev/u/MLEnthusiastic)\
**Replies:** 1\
**Last updated:** [November 7, 2024, 4:19pm UTC](https://discuss.ai.google.dev/t/jit-compile-set-to-false-in-compile-function-and-set-to-true-globally/30974 "2024-11-07T16:19:03Z")

</div>

Hi, I have only one model in my code and before compiling the model I am setting this: tf.config.optimizer.set\_jit(True) but when I compile the model, I set the jit\_compile parameter to false. What I am seeing is, wh…

---

## [Categorical Crossentropy Label Smoothing](https://discuss.ai.google.dev/t/categorical-crossentropy-label-smoothing/29370)

<div class="topic-metadata">

**Author:** [@coco](https://discuss.ai.google.dev/u/coco)\
**Replies:** 1\
**Last updated:** [November 6, 2024, 10:25am UTC](https://discuss.ai.google.dev/t/categorical-crossentropy-label-smoothing/29370 "2024-11-06T10:25:00Z")

</div>

Hello, I was trying to figure out what the label\_smoothing parameter did for the loss “Categorical Crossentropy” and looking at the code, I came across this (keras/keras/losses/losses.py at v3.1.1 · keras-team/keras · G…

---

## [Graph execution error at model.fit() function call](https://discuss.ai.google.dev/t/graph-execution-error-at-model-fit-function-call/31986)

<div class="topic-metadata">

**Author:** [@Aryan\_Malewar](https://discuss.ai.google.dev/u/Aryan_Malewar)\
**Replies:** 1\
**Last updated:** [November 5, 2024, 10:07am UTC](https://discuss.ai.google.dev/t/graph-execution-error-at-model-fit-function-call/31986 "2024-11-05T10:07:54Z")

</div>

Hey, I’m trying to fine-tune VGG16 model for object detection. I’ve added a few dense layers and freezed the convolutional layers. There are 2 outputs of the model (bounding boxes and class labels) and the input is 512\*5…

---

## [Single-sample evaluation (prediction/inference) speed for simple MLP slower in Keras compared to skl](https://discuss.ai.google.dev/t/single-sample-evaluation-prediction-inference-speed-for-simple-mlp-slower-in-keras-compared-to-skl/44107)

<div class="topic-metadata">

**Author:** [@willb](https://discuss.ai.google.dev/u/willb)\
**Replies:** 6\
**Last updated:** [October 30, 2024, 11:47am UTC](https://discuss.ai.google.dev/t/single-sample-evaluation-prediction-inference-speed-for-simple-mlp-slower-in-keras-compared-to-skl/44107 "2024-10-30T11:47:11Z")

</div>

Hello, Can someone help me speed understand why a simple keras MLP binary classifier evaluates (predicts) significantly slower for single samples than the skl MLPClassifier, despite it training much quicker than it. I a…

---

## [Can't create any models with tf.keras](https://discuss.ai.google.dev/t/cant-create-any-models-with-tf-keras/46101)

<div class="topic-metadata">

**Author:** [@helf4ch](https://discuss.ai.google.dev/u/helf4ch)\
**Replies:** 1\
**Last updated:** [October 26, 2024, 2:07pm UTC](https://discuss.ai.google.dev/t/cant-create-any-models-with-tf-keras/46101 "2024-10-26T14:07:10Z")

</div>

I’m getting the same error over and over. Already reinstall everything I can without reinstalling the whole system. I using Arch linux 6.11.3-zen1-1-zen. Code that caused issues: import tensorflow as tf print("TensorFl…

---

## [Error on converting ragged tensors to dense](https://discuss.ai.google.dev/t/error-on-converting-ragged-tensors-to-dense/21041)

<div class="topic-metadata">

**Author:** [@Dmitry\_Redgrave](https://discuss.ai.google.dev/u/Dmitry_Redgrave)\
**Replies:** 1\
**Last updated:** [October 25, 2024, 9:29am UTC](https://discuss.ai.google.dev/t/error-on-converting-ragged-tensors-to-dense/21041 "2024-10-25T09:29:53Z")

</div>

I’m training SegNet architecture model and my dataset contains images of different resolutions. For this reason, I need to use ragged tensors when training. To do this, I wrote the simplest layer: class RaggedToDenseTe…

---

## [Step function as activation during testing](https://discuss.ai.google.dev/t/step-function-as-activation-during-testing/32028)

<div class="topic-metadata">

**Author:** [@Flexe](https://discuss.ai.google.dev/u/Flexe)\
**Replies:** 1\
**Last updated:** [October 24, 2024, 9:42am UTC](https://discuss.ai.google.dev/t/step-function-as-activation-during-testing/32028 "2024-10-24T09:42:15Z")

</div>

Hallo everyone, I’m very new in the forum and also new-worker with tensorflow/keras. Last time I received a mail from a friend (not availabe anymore). If you have a sigmoid function \*\* sigma(x) = 1/(1+exp(-x))\*\* the…

---

## [Discrepancy in KL Divergence Calculation Using \`tf.keras.metrics.KLDivergence'](https://discuss.ai.google.dev/t/discrepancy-in-kl-divergence-calculation-using-tf-keras-metrics-kldivergence/34736)

<div class="topic-metadata">

**Author:** [@Chashi\_Xianke](https://discuss.ai.google.dev/u/Chashi_Xianke)\
**Replies:** 1\
**Last updated:** [October 24, 2024, 9:04am UTC](https://discuss.ai.google.dev/t/discrepancy-in-kl-divergence-calculation-using-tf-keras-metrics-kldivergence/34736 "2024-10-24T09:04:12Z")

</div>

Hi, I’ve encountered a discrepancy when calculating KL Divergence using TensorFlow’s tf.keras.metrics.KLDivergence metric compared to a manual calculation. Here’s a summary of what I’ve observed: Manual Calculation: …

---

## [Adding a few more layers to pre\_trained\_model](https://discuss.ai.google.dev/t/adding-a-few-more-layers-to-pre-trained-model/32620)

<div class="topic-metadata">

**Author:** [@Seungjun\_Lee](https://discuss.ai.google.dev/u/Seungjun_Lee)\
**Replies:** 1\
**Last updated:** [October 23, 2024, 5:41pm UTC](https://discuss.ai.google.dev/t/adding-a-few-more-layers-to-pre-trained-model/32620 "2024-10-23T17:41:15Z")

</div>

Can someone explain me why first version of code works but not second? I first loaded a InceptionV3 pertained model as follow: pre\_trained\_model = InceptionV3(input\_shape = (150, 150, 3), …

---

## [Introducing Keras Hub: Your one-stop shop for pretrained models](https://discuss.ai.google.dev/t/introducing-keras-hub-your-one-stop-shop-for-pretrained-models/45297)

<div class="topic-metadata">

**Author:** [@pradeepkuppala](https://discuss.ai.google.dev/u/pradeepkuppala)\
**Replies:** 1\
**Last updated:** [October 23, 2024, 1:23pm UTC](https://discuss.ai.google.dev/t/introducing-keras-hub-your-one-stop-shop-for-pretrained-models/45297 "2024-10-23T13:23:15Z")

</div>

---

## [URGENT: issue encountered in Text generation with an RNN tutorial](https://discuss.ai.google.dev/t/urgent-issue-encountered-in-text-generation-with-an-rnn-tutorial/43016)

<div class="topic-metadata">

**Author:** [@abdullah\_ahmad](https://discuss.ai.google.dev/u/abdullah_ahmad)\
**Replies:** 2\
**Last updated:** [October 21, 2024, 7:21am UTC](https://discuss.ai.google.dev/t/urgent-issue-encountered-in-text-generation-with-an-rnn-tutorial/43016 "2024-10-21T07:21:04Z")

</div>

def call(self, inputs, states=None, return\_state=False, training=False): x = inputs x = self.embedding(x, training=training) if states is None: states = self.gru.get\_initial\_state(x) x, states = self.gru(x, initial\_…

---

## [Train\_on\_batch and train\_step used in custom training loop giving different results](https://discuss.ai.google.dev/t/train-on-batch-and-train-step-used-in-custom-training-loop-giving-different-results/32197)

<div class="topic-metadata">

**Author:** [@kilodalton](https://discuss.ai.google.dev/u/kilodalton)\
**Replies:** 1\
**Last updated:** [October 15, 2024, 5:57pm UTC](https://discuss.ai.google.dev/t/train-on-batch-and-train-step-used-in-custom-training-loop-giving-different-results/32197 "2024-10-15T17:57:19Z")

</div>

I have a custom model class which has a training method implemented using train\_step. class MyFancyModel(tfk.models.Model): ... def train\_model(self, data, message=None): @tf.function() def tr…

---

## [The metric has not yet been built error](https://discuss.ai.google.dev/t/the-metric-has-not-yet-been-built-error/38686)

<div class="topic-metadata">

**Author:** [@Clarence\_Ng](https://discuss.ai.google.dev/u/Clarence_Ng)\
**Replies:** 3\
**Last updated:** [October 15, 2024, 6:07am UTC](https://discuss.ai.google.dev/t/the-metric-has-not-yet-been-built-error/38686 "2024-10-15T06:07:43Z")

</div>

Hi everyone, i was stacking 5 pretrain model sort of like transfer learning. I was facing issue about The metric has not yet been built error issue and I not sure how to solve it. i am using tensorflow 2.17 version. I…

---

## [Binary Image Classification Same precision and recall with sixteen decimal digits](https://discuss.ai.google.dev/t/binary-image-classification-same-precision-and-recall-with-sixteen-decimal-digits/42074)

<div class="topic-metadata">

**Author:** [@KerasWizardBeginner](https://discuss.ai.google.dev/u/KerasWizardBeginner)\
**Replies:** 7\
**Last updated:** [October 10, 2024, 7:21am UTC](https://discuss.ai.google.dev/t/binary-image-classification-same-precision-and-recall-with-sixteen-decimal-digits/42074 "2024-10-10T07:21:21Z")

</div>

I there. I am attempting to implement a new neuron initializer (licensed under my university), that had prove that so far works well with multiclass identification type of problem. Corrently i am facing a strange behavio…

---

## [Im working on a project but im getting an error and i dont even know where to head](https://discuss.ai.google.dev/t/im-working-on-a-project-but-im-getting-an-error-and-i-dont-even-know-where-to-head/41081)

<div class="topic-metadata">

**Author:** [@Fmosh](https://discuss.ai.google.dev/u/Fmosh)\
**Replies:** 3\
**Last updated:** [October 9, 2024, 6:50am UTC](https://discuss.ai.google.dev/t/im-working-on-a-project-but-im-getting-an-error-and-i-dont-even-know-where-to-head/41081 "2024-10-09T06:50:38Z")

</div>

do you guys know what the issue is because I cant find the problem, I have downloaded tensorflow using python?

---

## [No module named 'keras.src.engine'](https://discuss.ai.google.dev/t/no-module-named-keras-src-engine/40742)

<div class="topic-metadata">

**Author:** [@Walmir\_Cardoso\_dos\_S](https://discuss.ai.google.dev/u/Walmir_Cardoso_dos_S)\
**Replies:** 1\
**Last updated:** [September 30, 2024, 6:55am UTC](https://discuss.ai.google.dev/t/no-module-named-keras-src-engine/40742 "2024-09-30T06:55:44Z")

</div>

Estou executando um codigo que estava no meu colab , o mesmo estava parado a uns 3 meses que eu não mexia. Quando vou tenta carregar os modelos ReseNet50 e IncepetionV3 sempre me retorna um erro de \`No module named ‘ke…

---

## [Exception encountered when calling layer 'softmax' (type Softmax)](https://discuss.ai.google.dev/t/exception-encountered-when-calling-layer-softmax-type-softmax/31904)

<div class="topic-metadata">

**Author:** [@Igor\_Lessio](https://discuss.ai.google.dev/u/Igor_Lessio)\
**Replies:** 1\
**Last updated:** [September 19, 2024, 6:04pm UTC](https://discuss.ai.google.dev/t/exception-encountered-when-calling-layer-softmax-type-softmax/31904 "2024-09-19T18:04:47Z")

</div>

Im trying to deploy a TFT on my data but even trying 4 different approach once i arrive intot he mutihead i keep having same error on and on. here the shapes and the code i use. Shapes for the data: Before splitting th…

---

## [How to use Keras FeatureSpace to ingest a dataframe that has an embedding column?](https://discuss.ai.google.dev/t/how-to-use-keras-featurespace-to-ingest-a-dataframe-that-has-an-embedding-column/31497)

<div class="topic-metadata">

**Author:** [@Cassandra\_Xia](https://discuss.ai.google.dev/u/Cassandra_Xia)\
**Replies:** 1\
**Last updated:** [September 19, 2024, 4:18pm UTC](https://discuss.ai.google.dev/t/how-to-use-keras-featurespace-to-ingest-a-dataframe-that-has-an-embedding-column/31497 "2024-09-19T16:18:39Z")

</div>

Hi there! I’m following the example that reads in a pandas dataframe using FeatureSpace in Structured data classification with FeatureSpace - the example works out of the box. I am now trying to modify the example: One …

---

## [Masking propagation through layers](https://discuss.ai.google.dev/t/masking-propagation-through-layers/30920)

<div class="topic-metadata">

**Author:** [@mk6](https://discuss.ai.google.dev/u/mk6)\
**Replies:** 1\
**Last updated:** [September 19, 2024, 7:38am UTC](https://discuss.ai.google.dev/t/masking-propagation-through-layers/30920 "2024-09-19T07:38:26Z")

</div>

I’m confused about the handling of mask since there seems confict to me. In tf.keras.layers.Masking: If any downstream layer does not support masking yet receives such an input mask, an exception will be raised. In…

---

## [Keras-Tuner parallel processing using multi-core CPU](https://discuss.ai.google.dev/t/keras-tuner-parallel-processing-using-multi-core-cpu/30535)

<div class="topic-metadata">

**Author:** [@ibnfaisalc](https://discuss.ai.google.dev/u/ibnfaisalc)\
**Replies:** 1\
**Last updated:** [September 18, 2024, 5:05pm UTC](https://discuss.ai.google.dev/t/keras-tuner-parallel-processing-using-multi-core-cpu/30535 "2024-09-18T17:05:19Z")

</div>

Hello all, I am currently running a hyperparameter search using GridSearch. I wanted to get some clarification on whether or not Keras-Tuner can utilize multiple CPU cores/threads to speed up the process of Hyperparamet…

---

## [LSTM Keras API: Handling two cases; y\<t\> = x\<t+1\> and y\<t\> = x\<t\>](https://discuss.ai.google.dev/t/lstm-keras-api-handling-two-cases-y-t-x-t-1-and-y-t-x-t/28158)

<div class="topic-metadata">

**Author:** [@Seungjun\_Lee](https://discuss.ai.google.dev/u/Seungjun_Lee)\
**Replies:** 1\
**Last updated:** [September 18, 2024, 9:06am UTC](https://discuss.ai.google.dev/t/lstm-keras-api-handling-two-cases-y-t-x-t-1-and-y-t-x-t/28158 "2024-09-18T09:06:08Z")

</div>

I’m learning how to implement LSTM using Keras API, and got a question regard how I can handle two different cases; y = x and y = x For example, the following code builds a simple LSTM in Keras: inputs = tf.random.norm…

---

## [Image Classification with the ability to verify Fonts and image abnormalities or errors in the image](https://discuss.ai.google.dev/t/image-classification-with-the-ability-to-verify-fonts-and-image-abnormalities-or-errors-in-the-image/28497)

<div class="topic-metadata">

**Author:** [@Rod\_Neufeld](https://discuss.ai.google.dev/u/Rod_Neufeld)\
**Replies:** 1\
**Last updated:** [September 17, 2024, 8:56am UTC](https://discuss.ai.google.dev/t/image-classification-with-the-ability-to-verify-fonts-and-image-abnormalities-or-errors-in-the-image/28497 "2024-09-17T08:56:47Z")

</div>

Hi I am working on a project to classify football (Soccer) team crests, I have a working model that accomplishes the initial classifications. I need to develop not only the ability to verify that the image is indeed a pa…

---

## [Dense input Shape not matching expected shape](https://discuss.ai.google.dev/t/dense-input-shape-not-matching-expected-shape/39295)

<div class="topic-metadata">

**Author:** [@Timus](https://discuss.ai.google.dev/u/Timus)\
**Replies:** 1\
**Last updated:** [September 15, 2024, 7:28am UTC](https://discuss.ai.google.dev/t/dense-input-shape-not-matching-expected-shape/39295 "2024-09-15T07:28:06Z")

</div>

Hi guys, I’m new to this topic, so please bear with me. I am trying to set up a CNN Network for the classification of sleep stages (5). I have come up with the following CNN structure: ecg\_input = Input(shape=(7680, 1),…

---

## [Problem of compilation of model](https://discuss.ai.google.dev/t/problem-of-compilation-of-model/38556)

<div class="topic-metadata">

**Author:** [@Nicolas\_Orefice](https://discuss.ai.google.dev/u/Nicolas_Orefice)\
**Replies:** 1\
**Last updated:** [September 9, 2024, 8:34am UTC](https://discuss.ai.google.dev/t/problem-of-compilation-of-model/38556 "2024-09-09T08:34:09Z")

</div>

Hi I got a problem when i want to compile my nlp model using keras on google colab. here is my code : model = Sequential() model.add(Embedding(input\_dim=len(tokenizer.word\_index) + 1, output\_dim=128, input\_length=max…

---

## [Just started tutorial. Convolutional layer modification](https://discuss.ai.google.dev/t/just-started-tutorial-convolutional-layer-modification/36678)

<div class="topic-metadata">

**Author:** [@Kelly\_McTiernan](https://discuss.ai.google.dev/u/Kelly_McTiernan)\
**Replies:** 1\
**Last updated:** [August 27, 2024, 7:25am UTC](https://discuss.ai.google.dev/t/just-started-tutorial-convolutional-layer-modification/36678 "2024-08-27T07:25:28Z")

</div>

I may be getting ahead of myself, but I just started the tuitorial. I modified the code to use a convolutional layer, and got much better accuracy and loss. Below is the modified code: # TensorFlow and tf.keras import…

[Previous page](https://discuss.ai.google.dev/c/keras/22.md?page=1)

[Next page](https://discuss.ai.google.dev/c/keras/22.md?page=3)
