From 1b8d287dd0a99e6bcf2c397d49285aab7d0b75c5 Mon Sep 17 00:00:00 2001 From: Simon Zhao Date: Mon, 22 Jan 2024 22:34:42 +0800 Subject: [PATCH] Replace LayerRNNCell with AbstractRNNCell Signed-off-by: Simon Zhao --- recommenders/models/deeprec/models/sequential/sum_cells.py | 5 ++++- setup.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/recommenders/models/deeprec/models/sequential/sum_cells.py b/recommenders/models/deeprec/models/sequential/sum_cells.py index d66ae60e9..db83ab261 100644 --- a/recommenders/models/deeprec/models/sequential/sum_cells.py +++ b/recommenders/models/deeprec/models/sequential/sum_cells.py @@ -3,7 +3,10 @@ import numpy as np import tensorflow as tf -from keras.layers.legacy_rnn.rnn_cell_impl import LayerRNNCell +try: + from keras.layers.legacy_rnn.rnn_cell_impl import LayerRNNCell +except: + from keras.layers.rnn import AbstractRNNCell as LayerRNNCell from tensorflow.python.eager import context from tensorflow.python.keras import activations from tensorflow.python.keras import initializers diff --git a/setup.py b/setup.py index 975727660..caa526087 100644 --- a/setup.py +++ b/setup.py @@ -72,7 +72,7 @@ "pytest>=3.6.4", "pytest-cov>=2.12.1", "pytest-mock>=3.6.1", # for access to mock fixtures in pytest - "packaging>=20.9", # for version comparison in test_dependency_security.py + "packaging>=20.9", # for version comparison in test_dependency_security.py ], } # For the brave of heart