# C4\_W4\_Lab\_3\_CelebA\_GAN\_Experiments tensorflow.python.framework.errors\_impl.OutOfRangeError: End of sequence

**URL:** <https://community.deeplearning.ai/t/c4-w4-lab-3-celeba-gan-experiments-tensorflow-python-framework-errors-impl-outofrangeerror-end-of-sequence/492410>\
**Category:** Generative Deep Learning with TensorFlow\
**Tags:** week-module-4\
**Created:** [November 12, 2023, 6:38am UTC](https://community.deeplearning.ai/t/c4-w4-lab-3-celeba-gan-experiments-tensorflow-python-framework-errors-impl-outofrangeerror-end-of-sequence/492410 "2023-11-12T06:38:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thierry\_Pochon](https://avatars.discourse-cdn.com/v4/letter/t/6bbea6/32.png) [@Thierry\_Pochon](https://community.deeplearning.ai/u/Thierry_Pochon)\
**Post date:** [November 12, 2023, 6:38am UTC](https://community.deeplearning.ai/t/c4-w4-lab-3-celeba-gan-experiments-tensorflow-python-framework-errors-impl-outofrangeerror-end-of-sequence/492410/1 "2023-11-12T06:38:29Z")

</div>

Hello,

When I do Run all cells (without any modification) in notebook C4\_W4\_Lab\_3\_CelebA\_GAN\_Experiments : week 4 lab 3 " Ungraded Lab: CelebA GAN Experiments" of " Generative Deep Learning with TensorFlow" course,  
when I execute the cell to train the GAN and generating images :

```auto
# generate a batch of noisy input
test_z = tf.random.normal(shape=(64, 1, 1, z_dim))

# start loop
for epoch in range(30):
    with tqdm(dataset) as pbar:
        pbar.set_description(f"[Epoch {epoch}]")
        for step, (X1, X2) in enumerate(pbar):
            # train on the current batch
            d_loss, g_loss, fake = train_on_batch(X1, X2)

            # display the losses
            pbar.set_postfix({"g_loss": g_loss.numpy(), "d_loss": d_loss.numpy()})

        # generate fake images
        fake_img = model_G(test_z)

    # save output
    if not os.path.exists(out_dir):
        os.makedirs(out_dir)
    file_path = out_dir+f"/epoch_{epoch:04}.png"
    save_img(fake_img.numpy()[:64], file_path, 8)

    # display gallery of fake faces
    if epoch % 1 == 0:
        with Image.open(file_path) as img:
            plt.imshow(np.asarray(img))
            plt.show()

```

At each epoch, at step 1580, I get the error :

```auto
Epoch 0]: : 1580it [01:09, 30.46it/s, g_loss=1e+4, d_loss=33.3]Exception ignored in: <function Executor. __del__ at 0x7e9554558c10>
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/tensorflow/python/eager/executor.py", line 46, in __del__
    self.wait()
  File "/usr/local/lib/python3.10/dist-packages/tensorflow/python/eager/executor.py", line 65, in wait
    pywrap_tfe.TFE_ExecutorWaitForAllPendingNodes(self._handle)
tensorflow.python.framework.errors_impl.OutOfRangeError: End of sequence
[Epoch 0]: : 1582it [01:09, 22.84it/s, g_loss=1e+4, d_loss=33.3]

```

=\> and the generated images does not improve and stay all yellow

Help appreciated  
Best regards  
Thierry

---

<div class="post-metadata">

**Author:** ![gent.spah](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/gent.spah/32/136423_2.png) [@gent.spah](https://community.deeplearning.ai/u/gent.spah)\
**Post date:** [November 12, 2023, 7:25am UTC](https://community.deeplearning.ai/t/c4-w4-lab-3-celeba-gan-experiments-tensorflow-python-framework-errors-impl-outofrangeerror-end-of-sequence/492410/2 "2023-11-12T07:25:38Z")

</div>

Hello,

I ran the notebook right now and yes I got an exception which was ignored and it seems the images are improving. Close the page and rerun the whole thing if the images dont improve at all with time.

---

<div class="post-metadata">

**Author:** ![Thierry\_Pochon](https://avatars.discourse-cdn.com/v4/letter/t/6bbea6/32.png) [@Thierry\_Pochon](https://community.deeplearning.ai/u/Thierry_Pochon)\
**Post date:** [December 1, 2023, 4:02pm UTC](https://community.deeplearning.ai/t/c4-w4-lab-3-celeba-gan-experiments-tensorflow-python-framework-errors-impl-outofrangeerror-end-of-sequence/492410/3 "2023-12-01T16:02:34Z")

</div>

Hello,  
Indeed, you are right, re-running the notebook, I still have the error but the generated images are improving  
Thank you  
Do you know how to fix the error ? Do you know the root cause ?  
Best regards  
Thierry

---

<div class="post-metadata">

**Author:** ![gent.spah](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/gent.spah/32/136423_2.png) [@gent.spah](https://community.deeplearning.ai/u/gent.spah)\
**Post date:** [December 3, 2023, 7:30am UTC](https://community.deeplearning.ai/t/c4-w4-lab-3-celeba-gan-experiments-tensorflow-python-framework-errors-impl-outofrangeerror-end-of-sequence/492410/4 "2023-12-03T07:30:28Z")

</div>

No I cannot take a a guess right now as to what the problem might be!
