# \#tf-train

**URL:** https://discuss.ai.google.dev/tag/tf-train/203.md

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

---

## [Help needed: Transformer for candlestick prediction not learning](https://discuss.ai.google.dev/t/help-needed-transformer-for-candlestick-prediction-not-learning/105605)

<div class="topic-metadata">

**Author:** [@Venon](https://discuss.ai.google.dev/u/Venon)\
**Replies:** 1\
**Last updated:** [February 5, 2026, 9:26am UTC](https://discuss.ai.google.dev/t/help-needed-transformer-for-candlestick-prediction-not-learning/105605 "2026-02-05T09:26:08Z")

</div>

Hello everyone, I’m working on a project where I try to predict candlestick features (open, close, high, low) using a Transformer architecture in Keras. I am not an expert in Transformers, so I’m looking for advice and…

---

## [Tensorflow records get corrupted randomly (TF 2.15)](https://discuss.ai.google.dev/t/tensorflow-records-get-corrupted-randomly-tf-2-15/71507)

<div class="topic-metadata">

**Author:** [@Cola\_Lightyear](https://discuss.ai.google.dev/u/Cola_Lightyear)\
**Replies:** 1\
**Last updated:** [March 12, 2025, 4:50pm UTC](https://discuss.ai.google.dev/t/tensorflow-records-get-corrupted-randomly-tf-2-15/71507 "2025-03-12T16:50:23Z")

</div>

Hi, I am performing a considerable amount of random search iterations to find good hyperparameters of a model. The data I am using is stored in tensorflow records. My model trains fine for many epochs. There have been p…

---

## [None gradient using custom loss function that uses MSSIM](https://discuss.ai.google.dev/t/none-gradient-using-custom-loss-function-that-uses-mssim/31569)

<div class="topic-metadata">

**Author:** [@Ahmad\_Hazem](https://discuss.ai.google.dev/u/Ahmad_Hazem)\
**Replies:** 1\
**Last updated:** [January 3, 2025, 2:58pm UTC](https://discuss.ai.google.dev/t/none-gradient-using-custom-loss-function-that-uses-mssim/31569 "2025-01-03T14:58:58Z")

</div>

Hello, I am a novice with tensorflow, I am trying create a custom loss function that uses MSSIM. I am trying to calculate the MSSIM of a ground truth with the gradcam++ sailancy map of the input image. Bellow is some of…

---

## [Having problems with training model](https://discuss.ai.google.dev/t/having-problems-with-training-model/38046)

<div class="topic-metadata">

**Author:** [@Bashaar\_Dhoot](https://discuss.ai.google.dev/u/Bashaar_Dhoot)\
**Replies:** 2\
**Last updated:** [September 7, 2024, 7:35pm UTC](https://discuss.ai.google.dev/t/having-problems-with-training-model/38046 "2024-09-07T19:35:58Z")

</div>

I am having problems with loading my data to train. I think I have not converted the data types correctly. I am following a tutorial and using copilot and I might have got too confused. here this the error message: Epo…

---

## [ValueError: \`logits\` and \`labels\` must have the same shape, received ((None, 1) vs (None, 200))](https://discuss.ai.google.dev/t/valueerror-logits-and-labels-must-have-the-same-shape-received-none-1-vs-none-200/27691)

<div class="topic-metadata">

**Author:** [@The\_Machine\_Preacher](https://discuss.ai.google.dev/u/The_Machine_Preacher)\
**Replies:** 6\
**Last updated:** [June 7, 2024, 9:42am UTC](https://discuss.ai.google.dev/t/valueerror-logits-and-labels-must-have-the-same-shape-received-none-1-vs-none-200/27691 "2024-06-07T09:42:42Z")

</div>

I tried to train a convolutional neural network to predict the labels (categorical data) given the criteria (text). This should have been a simple classification problem. There are 7 labels, hence my network has 7 output…

---

## [The model misclassify on categories](https://discuss.ai.google.dev/t/the-model-misclassify-on-categories/27106)

<div class="topic-metadata">

**Author:** [@Palak\_Talreja](https://discuss.ai.google.dev/u/Palak_Talreja)\
**Replies:** 1\
**Last updated:** [May 19, 2024, 9:09am UTC](https://discuss.ai.google.dev/t/the-model-misclassify-on-categories/27106 "2024-05-19T09:09:02Z")

</div>

---

## [Pipeline parallel reading and training data](https://discuss.ai.google.dev/t/pipeline-parallel-reading-and-training-data/30392)

<div class="topic-metadata">

**Author:** [@wu\_Heng](https://discuss.ai.google.dev/u/wu_Heng)\
**Replies:** 1\
**Last updated:** [May 17, 2024, 7:16am UTC](https://discuss.ai.google.dev/t/pipeline-parallel-reading-and-training-data/30392 "2024-05-17T07:16:33Z")

</div>

I have a classification task, the data is about 10 million files, each file corresponds to a classification marker, from these 10 million files, each file can be loaded with a 1000 dimensional numeric vector, now I want …

---

## [Train Test Split Using np.random.rand()](https://discuss.ai.google.dev/t/train-test-split-using-np-random-rand/27619)

<div class="topic-metadata">

**Author:** [@Shiv\_Katira](https://discuss.ai.google.dev/u/Shiv_Katira)\
**Replies:** 1\
**Last updated:** [May 7, 2024, 9:08am UTC](https://discuss.ai.google.dev/t/train-test-split-using-np-random-rand/27619 "2024-05-07T09:08:30Z")

</div>

Why TensorFlow documentation uses np.random.rand() function to create train test split of the dataset? For example: def split\_dataset(dataset, test\_ratio=0.30): """Splits a panda dataframe in two.""" test\_indices = …

---

## [How to analyze and classify an image based on the training set](https://discuss.ai.google.dev/t/how-to-analyze-and-classify-an-image-based-on-the-training-set/30353)

<div class="topic-metadata">

**Author:** [@Fatih\_Ikiz](https://discuss.ai.google.dev/u/Fatih_Ikiz)\
**Replies:** 1\
**Last updated:** [April 12, 2024, 7:08am UTC](https://discuss.ai.google.dev/t/how-to-analyze-and-classify-an-image-based-on-the-training-set/30353 "2024-04-12T07:08:35Z")

</div>

Hello, I’m new to Pyton and Tensforlow (just started learning) and I have few questions. My aim is to train the algoritm with sample images (e.g, ischemic areas in MRI imaging, as well as normal ones) and classify the n…

---

## [Drop in accuracy after evaluating the model](https://discuss.ai.google.dev/t/drop-in-accuracy-after-evaluating-the-model/31044)

<div class="topic-metadata">

**Author:** [@MLEnthusiastic](https://discuss.ai.google.dev/u/MLEnthusiastic)\
**Replies:** 1\
**Last updated:** [April 5, 2024, 4:18pm UTC](https://discuss.ai.google.dev/t/drop-in-accuracy-after-evaluating-the-model/31044 "2024-04-05T16:18:32Z")

</div>

Hi, I have trained my model and then applied QAT on it and re-train it again. During training the QAT model I can see that my metrics are doing very well. But, when I evaluate my model after the train phase has been fin…

---

## [Accuracy metrics in multi-class multi-label classification](https://discuss.ai.google.dev/t/accuracy-metrics-in-multi-class-multi-label-classification/28678)

<div class="topic-metadata">

**Author:** [@kdlin1](https://discuss.ai.google.dev/u/kdlin1)\
**Replies:** 10\
**Last updated:** [April 5, 2024, 4:31am UTC](https://discuss.ai.google.dev/t/accuracy-metrics-in-multi-class-multi-label-classification/28678 "2024-04-05T04:31:09Z")

</div>

I use “accuracy” as a metric in the model.compile method for a multi-class multi-label classification problem. It yields poor accuracy numbers in the model.fit and model.evaluate methods. However, when I use “y\_hat = mod…

---

## [Train for sounds, not just words?](https://discuss.ai.google.dev/t/train-for-sounds-not-just-words/30681)

<div class="topic-metadata">

**Author:** [@gamename](https://discuss.ai.google.dev/u/gamename)\
**Replies:** 0\
**Last updated:** [March 13, 2024, 10:01pm UTC](https://discuss.ai.google.dev/t/train-for-sounds-not-just-words/30681 "2024-03-13T22:01:07Z")

</div>

The first item in tensorflow/lite/micro/examples/micro\_speech/train/train\_micro\_speech\_model.ipynb says: # A comma-delimited list of the words you want to train for. # The options are: yes,no,up,down,left,right,on,off,…

---

## [Tensorflow - self.metrics does not contain compiled metrics in train\_step()](https://discuss.ai.google.dev/t/tensorflow-self-metrics-does-not-contain-compiled-metrics-in-train-step/24601)

<div class="topic-metadata">

**Author:** [@Gilles\_Jack](https://discuss.ai.google.dev/u/Gilles_Jack)\
**Replies:** 2\
**Last updated:** [February 25, 2024, 3:29am UTC](https://discuss.ai.google.dev/t/tensorflow-self-metrics-does-not-contain-compiled-metrics-in-train-step/24601 "2024-02-25T03:29:25Z")

</div>

In the code below, I overridded train\_step(), but self.metrics does not contain compiled metrics. As a result the verbose of fit() does not show the compiled metrics and the history does not contains the metrics. How c…

---

## [Cast string to float is not supported](https://discuss.ai.google.dev/t/cast-string-to-float-is-not-supported/31219)

<div class="topic-metadata">

**Author:** [@Sam\_Humphreys](https://discuss.ai.google.dev/u/Sam_Humphreys)\
**Replies:** 1\
**Last updated:** [February 20, 2024, 6:11am UTC](https://discuss.ai.google.dev/t/cast-string-to-float-is-not-supported/31219 "2024-02-20T06:11:10Z")

</div>

I get an error saying: Cast string to float is not supported \[\[{{node model\_2/Cast}}\]\] \[Op:\_\_inference\_train\_function\_8603\]. I am very new to tensorflow, and I copied a tutorial and tried to fit it to my requirement, so …

---

## [Negative Prediction Values](https://discuss.ai.google.dev/t/negative-prediction-values/32169)

<div class="topic-metadata">

**Author:** [@Narsis](https://discuss.ai.google.dev/u/Narsis)\
**Replies:** 3\
**Last updated:** [February 13, 2024, 3:44pm UTC](https://discuss.ai.google.dev/t/negative-prediction-values/32169 "2024-02-13T15:44:15Z")

</div>

I’m attempting to predict traffic using an LSTM model, but the outcome of my predictions are negative values. Is this normal, or could it indicate an error? Following are my code: train\_predict = model.predict(X\_train) …

---

## [TF Dataset.window() not returning useful Dataset objects](https://discuss.ai.google.dev/t/tf-dataset-window-not-returning-useful-dataset-objects/32430)

<div class="topic-metadata">

**Author:** [@Richard\_Neuboeck](https://discuss.ai.google.dev/u/Richard_Neuboeck)\
**Replies:** 2\
**Last updated:** [January 18, 2024, 12:38am UTC](https://discuss.ai.google.dev/t/tf-dataset-window-not-returning-useful-dataset-objects/32430 "2024-01-18T00:38:05Z")

</div>

Hi knowledgable people, I have one hot encoded biological data of different length as feature and a simple float as label. Due to the length differences I’m building a ragged tensor from my feature array and combine thi…

---

## [After Standard(), how can we standard() again in service](https://discuss.ai.google.dev/t/after-standard-how-can-we-standard-again-in-service/30912)

<div class="topic-metadata">

**Author:** [@jplee](https://discuss.ai.google.dev/u/jplee)\
**Replies:** 1\
**Last updated:** [December 22, 2023, 10:36am UTC](https://discuss.ai.google.dev/t/after-standard-how-can-we-standard-again-in-service/30912 "2023-12-22T10:36:26Z")

</div>

def standard(train, test): mean = train.mean(axis=0) train -= mean std = train.std(axis=0) train /= std test -= mean test /= std standard(tf\_train\_x, tf\_test\_x) Make data smaller for standa…
