Try passing a Variable instead of a Tensor to your model.
print(model(Variable(x)))

For the moment, you can’t mixture Tensors and Variables. Also, autograd expect that the first argument that is returned is a Variable, and that’s not the case when you get the .data from self.theta for computing res.