How to Solve NameError: name 'layers' is not defined -- tensorflow

Solution: Import the 'layers' module

To Solve the error, add the following line to the top of your code.

from tensorflow.keras import layers

 

For more information:
Python tensorflow layers