From c1c7bc70fd831941f8836a6d2c63bea4bdac5dc2 Mon Sep 17 00:00:00 2001 From: Nikunj Chawla Date: Sun, 12 Sep 2021 00:54:14 -0500 Subject: [PATCH 1/2] Added version requirement for tensorflow --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index dd6b1be8a..87d90dec1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,4 +15,4 @@ pytest-cov qpsolvers scipy sortedcontainers -tensorflow \ No newline at end of file +tensorflow>=2.6.0 From fad20a28d8a9f46a10b03d6b07b0cea6c2ae2d9d Mon Sep 17 00:00:00 2001 From: Nikunj Chawla Date: Sun, 12 Sep 2021 00:54:36 -0500 Subject: [PATCH 2/2] Changed usages of keras to tensorflow.keras, which fixed the tests --- deep_learning4e.py | 3 ++- perception4e.py | 2 +- tests/test_deep_learning4e.py | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/deep_learning4e.py b/deep_learning4e.py index 9f5b0a8f7..bb29306da 100644 --- a/deep_learning4e.py +++ b/deep_learning4e.py @@ -4,7 +4,8 @@ import statistics import numpy as np -from keras import Sequential, optimizers +from tensorflow import keras +from tensorflow.keras import Sequential, optimizers from keras.layers import Embedding, SimpleRNN, Dense from keras.preprocessing import sequence diff --git a/perception4e.py b/perception4e.py index edd556607..bc39c0ece 100644 --- a/perception4e.py +++ b/perception4e.py @@ -1,7 +1,7 @@ """Perception (Chapter 24)""" import cv2 -import keras +from tensorflow import keras import matplotlib.pyplot as plt import numpy as np import scipy.signal diff --git a/tests/test_deep_learning4e.py b/tests/test_deep_learning4e.py index 34676b02b..9264c39f0 100644 --- a/tests/test_deep_learning4e.py +++ b/tests/test_deep_learning4e.py @@ -1,4 +1,5 @@ import pytest +from tensorflow import keras from keras.datasets import imdb from deep_learning4e import *