def test_gaussian_kernel_grad_theano_execute(): if not theano_available: raise SkipTest("Theano not available") D = 3 x = np.random.randn(D) y = np.random.randn(D) sigma = 2. gaussian_kernel_grad_theano(x, y, sigma)
def test_gaussian_kernel_grad_theano_result_equals_manual(): if not theano_available: raise SkipTest("Theano not available") D = 3 x = np.random.randn(D) y = np.random.randn(D) sigma = 2. grad = gaussian_kernel_grad_theano(x, y, sigma) grad_manual = gaussian_kernel_grad(x, y[np.newaxis, :], sigma)[0] print grad_manual print grad assert_allclose(grad, grad_manual)