TypeError:'NoneType'对象在我的tensorflow自定义训练循环中不可迭代

我进行了自定义的训练循环,当我将模型训练8个时期时,出现了错误。 “ TypeError:'NoneType'对象不可迭代”。 带有错误日志的完整输出:

Epoch 001: Loss: 0.234, Accuracy: 91.320%
Epoch 002: Loss: 0.227, Accuracy: 92.120%
Epoch 003: Loss: 0.237, Accuracy: 91.820%
Epoch 004: Loss: 0.232, Accuracy: 92.400%
Epoch 005: Loss: 0.192, Accuracy: 93.780%
Epoch 006: Loss: 0.211, Accuracy: 93.280%
Epoch 007: Loss: 0.195, Accuracy: 94.100%
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-45-e6c924f8c071> in <module>()
   6                                                           optimizer_obj,
   7                                                           loss_obj,
----> 8                                                           grad)

TypeError: 'NoneType' object is not iterable

Ps: The code was very large so I can't post it here, so kindly check the colab notebook, url https://colab.research.google.com/drive/1T1RiEn6fDcCUffFfxpWodSTFRNX0j96o?usp=sharing