From 7a8a622b5db1ec45d0dfe3b77b8e97fa1a1c62a1 Mon Sep 17 00:00:00 2001 From: James Hensman Date: Tue, 12 Aug 2014 11:27:50 +0100 Subject: [PATCH] strange bug in np.einsum fixed when using the _out_ argument (thanks T. Cohn) --- GPy/kern/_src/stationary.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPy/kern/_src/stationary.py b/GPy/kern/_src/stationary.py index 5500bb88..5aa570a4 100644 --- a/GPy/kern/_src/stationary.py +++ b/GPy/kern/_src/stationary.py @@ -173,7 +173,7 @@ class Stationary(Kern): tmp *= 2. X2 = X ret = np.empty(X.shape, dtype=np.float64) - [np.einsum('ij,ij->i', tmp, X[:,q][:,None]-X2[:,q][None,:], out=ret[:,q]) for q in xrange(self.input_dim)] + [np.sum(tmp*(X[:,q:q+1]-X2[:,q:q+1]), axis=1, out=ret[:,q]) for q in xrange(self.input_dim)] ret /= self.lengthscale**2 return ret