Hi,
I am trying to perform autograd in the following example, but unable to calculate gradients way back to the theta variable.
import torch
from torch.autograd import Variable
    theta = Variable(torch.randn(1)*3.1414)
    theta.requires_grad_(True)
    cosval = Variable(torch.cos(theta))
    cosval.requires_grad_(True)
    mat = Variable(torch.Tensor([1,cosval,cosval]))
    mat.requires_grad_(True)
    inpt = torch.Tensor([3,3,3])
    y = torch.dot(mat,inpt)
    y.backward(torch.ones(3))

when I ran the above code I am able to see the gradients of ‘mat’ but not for ‘cosval’ and ‘theta’. Here gradients for cosval and theta are none.