From 53f94e754faabe129075b1c288c3c109376c34e8 Mon Sep 17 00:00:00 2001 From: Vasil Zlatanov Date: Wed, 27 Feb 2019 18:35:41 +0000 Subject: Add if __main__ --- lenet.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lenet.py') diff --git a/lenet.py b/lenet.py index d09f3cc..37123bb 100644 --- a/lenet.py +++ b/lenet.py @@ -125,6 +125,7 @@ def test_classifier(model, x_test, y_true): plot_example_errors(y_pred, y_true, x_test) # If file run directly, perform quick test -x_train, y_train, x_val, y_val, _, _ = import_mnist() -model = train_classifier(x_train[:100], y_train[:100], x_val, y_val, epochs=1) -test_classifier(model, x_val, y_val) +if __name__ == '__main__': + x_train, y_train, x_val, y_val, _, _ = import_mnist() + model = train_classifier(x_train[:100], y_train[:100], x_val, y_val, epochs=1) + test_classifier(model, x_val, y_val) -- cgit v1.2.3-54-g00ecf