Skip to content

Commit 77e5c39

Browse files
committed
Update keras.backend for keras 3.
Signed-off-by: Jay Zhang <[email protected]>
1 parent 445a89e commit 77e5c39

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/keras2onnx_unit_tests/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212

1313
K = keras.backend
1414

15+
def is_keras_3():
16+
return tf.__version__.startswith("2.18") or tf.__version__.startswith("2.17") or tf.__version__.startswith("2.16")
17+
18+
if is_keras_3():
19+
import tf_keras
20+
K = tf_keras.backend
1521

1622
@pytest.fixture(scope='function')
1723
def runner():

0 commit comments

Comments
 (0)