Skip to content

Commit

Permalink
Compat change in applications_load_weight_test
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaKane2001 committed Dec 24, 2021
1 parent e17f378 commit 851ca16
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion keras/applications/applications_load_weight_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ def test_application_pretrained_weights_loading(self):
self.assertShapeEqual(model.output_shape, (None, _IMAGENET_CLASSES))
x = _get_elephant(model.input_shape[1:3])
x = app_module.preprocess_input(x)
preds = model(x).numpy()
try:
preds = model.predict(x) # Works in TF1
except:
preds = model(x).numpy() # Works in TF2
names = [p[1] for p in app_module.decode_predictions(preds)[0]]
# Test correct label is in top 3 (weak correctness test).
self.assertIn('African_elephant', names[:3])
Expand Down

0 comments on commit 851ca16

Please sign in to comment.