The error message is not really good here 
I guess the problem is that X_test is a Tensor and not a Variable?
Note that when you will not need gradients, you can create Variables with X_test_var = Variable(X_test, volatile=True) to notify the autograd engine that no gradient will be computed (and thus he can do some extra optimizations).