'Im getting this error "Graph is finalized and cannot be modified." when i try to run the code

fitted = cnn_small_bn.fit(X_train, dummy_y_train, batch_size=128, epochs=20, verbose=1, validation_split=0.2)

Error

RuntimeError                              Traceback (most recent call last)
<ipython-input-194-caf630db0238> in <module>()
----> 1 fitted = cnn_small_bn.fit(X_train, dummy_y_train, batch_size=128, epochs=20, verbose=1, validation_split=0.2)

13 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/ops.py in _check_not_finalized(self)
   3345     """
   3346     if self._finalized:
-> 3347       raise RuntimeError("Graph is finalized and cannot be modified.")
   3348 
   3349   def _add_op(self, op, op_name):

RuntimeError: Graph is finalized and cannot be modified.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source