When you do torch.tensor([torch.cos(self.theta), ...]), you are creating a new leaf variable which dosen’t connect the graph to theta. So now in your graph there is no way to reach theta, thus no gradient.
Use a list to hold those two values and then do matrix multiply using python @.