[Solved] TensorFlow Error: GetNext() failed because the iterator has not been initialized

Error Messages:
FailedPreconditionError (see above for traceback): GetNext() failed because the iterator has not been initialized. Ensure that you have run the initializer operation for this iterator before getting the next element. [[Node: IteratorGetNext = IteratorGetNextoutput_shapes=[, ], output_types=[DT_UINT8, DT_UINT8], _device=”/job:localhost/replica:0/task:0/device:CPU:0″]]

Solution:
Iterator is not initialized
Add before the error code: sess.run(iterator.initializer)

refer to: https://stackoverflow.com/questions/48443203/tensorflow-getnext-failed-because-the-iterator-has-not-been-initialized

Read More: