You should avoid for loop as it grow the graph size in theano (and make it slow).
Here you can fix the example by changing the jacobian_det to
def jacobian_det(self, y):
return tt.sum(y[1:,:], axis=0, keepdims=True) # <== keepdims to make sure broadcasting happens correctly