Skip to content

Commit a9f636f

Browse files
Fix keras nightly applications (#1661)
Signed-off-by: Tom Wildenhain <[email protected]>
1 parent becdcba commit a9f636f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/keras2onnx_applications/nightly_build/test_resnext.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77
import numpy as np
88
from mock_keras2onnx.proto import keras
99
from mock_keras2onnx.proto.tfcompat import is_tf2
10-
from keras.regularizers import l2
10+
if is_tf2:
11+
def l2(weight_decay):
12+
# old keras layer expects a tuple but tf keras wants a single value
13+
return keras.regularizers.l2(weight_decay[0])
14+
else:
15+
from keras.regularizers import l2
1116
from os.path import dirname, abspath
1217
sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '../../keras2onnx_tests/'))
1318
img_path = os.path.join(os.path.dirname(__file__), '../data', 'street.jpg')

0 commit comments

Comments
 (0)