Cannot tune sequential model given get different results for each run
It is common for the results of a machine learning model to vary slightly between runs, even when setting random seeds to a constant. While setting random seeds can help control for some sources of randomness and make your results more consistent between runs, it is still possible for the results to vary slightly. This is normal and to be expected. also the weights of a machine learning model will not be exactly the same after each run. The weights are initialized randomly at the beginning of training and are updated during training based on the data and the optimization algorithm used. As a result, the final weights of the model can vary slightly between runs.
I can see that the results you got were not changing significantly. 
Hopefully this was helpful @fickas,
The only sources of randomness in Keras are from Numpy's random module (weight inits) and from Theano (and those are all seeded with Numpy's random), e.g. dropout. Seeding the Numpy RNG should work.

Also by default Keras's model.compile() sets the shuffle argument as True. You should the set numpy seed before importing keras. e.g.:

```
import numpy as np
np.random.seed(1337)  # for reproducibility
from keras.models import Sequential
```

I can see that most of the provided Keras examples follow this pattern. Thank you!

 Still a bit concerned about tuning. When I ran simple tuning algorithm on a Sequential model, I came out with different architectures as best on every rerun, i.e., different number of layers and different nodes in each layer. It is kind of hard to average architectures across reruns.

My conjecture is this will also affect sklearn tuning algorithms, e.g., RandomSearch and HalvingSearch. They will not produce consistent "best parameters" on rerun. I plan to test this out in next couple days. I feel I am missing something because I would expect a hue and cry from the community if tuning libraries stopped working as expected and I have not seen any complaints.

Also, it still seems something changed in a version update. As I said, I would get consistent results with early versions of 2, but an update to latest 2 version changed things.

I did just try installing v2.8, and I now get consistent results with RandomSearchCV. When I use 2.12, I do not. So it appears something changed between 2.8 and 2.12. @fickas,
Thank you for opening this issue. Development of keras moved to another [repository](https://github.com/keras-team/keras/issues). 


Could you please post this issue on keras-team/keras [repo](https://github.com/keras-team/keras/issues).
To know more please refer:
https://discuss.tensorflow.org/t/keras-project-moved-to-new-repository-in-https-github-com-keras-team-keras/1999
Thank you!
 Calling [tf.keras.utils.set_random_seed](https://www.tensorflow.org/api_docs/python/tf/keras/utils/set_random_seed) sets the Python seed, the NumPy seed, and the TensorFlow seed. Setting these seeds is necessary to ensure any random numbers your program generates are also deterministic.

I tried to execute the code with the alternative approach by using tf.keras.utils.set_random_seed, and I was getting the same result while executing the mentioned code. Kindly find the gist of it [here](https://colab.research.google.com/gist/tilakrayal/d906cd28355958b4ea371cee7ba2866a/different_results.ipynb).

Could you please have a look at this official document for reference.
https://www.tensorflow.org/api_docs/python/tf/config/experimental/enable_op_determinism

Thank you! This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60768">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60768">No</a>

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Bug

### Have you reproduced the bug with TF nightly?

No

### Source

binary

### Tensorflow Version

2.12

### Custom Code

No

### OS Platform and Distribution

_No response_

### Mobile device

_No response_

### Python version

_No response_

### Bazel version

_No response_

### GCC/Compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current Behaviour?

I am trying to tune a sequential model. But if I rerun my tuning code, I get a different result for "best parameters" each time. I am not using GPUs. I have seeds set to a constant.

My tuning code ran fine under an earlier tf version. But when I updated to latest, it stopped producing replicable results.

Did a specific version give up on replicability? Is there a workaround for tuning?

### Standalone code to reproduce the issue

```shell
https://colab.research.google.com/drive/1wxa5PCf7kQhTKrDFlbehq-k8MGAQpwkK?usp=sharing
```


### Relevant log output

_No response_</details>