I want import in file ipynb:
from tensorflow.keras import layers
from tensorflow.keras import losses
My code looks like:
import matplotlib.pyplot as plt
import os
import re
import shutil
import string
import tensorflow as tf
from tensorflow.keras import layers
from tensorflow.keras import losses
But I get error:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[4], line 7
5 import string
6 import tensorflow as tf
----> 7 from tensorflow.keras import layers
8 from tensorflow.keras import losses
ModuleNotFoundError: No module named 'tensorflow.keras'
I have Linux and conda environment with version tensorflow 2.17.0, python 3.10.14 and keras 3.4.1.
I was trying change version tensorflow on 2.16 and keras on 3.3, 3.2, 3.1 but it didn't work. I need use layers to tutorial on tensorflow about "Basic text classification".
@casr give for me correct solution. I have change import from:
from tensorflow.keras import layers
from tensorflow.keras import losses
to:
from keras import layers
from keras import losses