From 384fe4f880fed83e10f676184455466b97f4bb43 Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado <55825613+luevano@users.noreply.github.com> Date: Wed, 11 Mar 2020 09:07:44 -0700 Subject: Add error handlers --- ml_exp/do_ml.py | 2 ++ ml_exp/kernels.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ml_exp/do_ml.py b/ml_exp/do_ml.py index eb57008b0..b37553c24 100644 --- a/ml_exp/do_ml.py +++ b/ml_exp/do_ml.py @@ -121,6 +121,8 @@ def simple_ml(descriptors, Y_pr = tf.tensordot(K_te, alpha, 1) mae = tf.reduce_mean(tf.abs(Y_pr - Y_te)) + else: + raise TypeError('No GPU found, could not create Tensor objects.') else: X_tr = descriptors[:training_size] Y_tr = energies[:training_size] diff --git a/ml_exp/kernels.py b/ml_exp/kernels.py index 599487b3a..2b40ae0b1 100644 --- a/ml_exp/kernels.py +++ b/ml_exp/kernels.py @@ -87,6 +87,8 @@ def laplauss_kernel(X1, i_state = (0, K) n, K = tf.while_loop(cond, body, i_state) K = K.stack() + else: + raise TypeError('No GPU found, could not create Tensor objects.') else: K = np.zeros((X1_size, X2_size), dtype=np.float64) # Faster way of calculating the kernel (no numba support). -- cgit v1.2.3-54-g00ecf