Computing derivatives of matrices for Gaussian Processes

Hi.

Can I compute matrix derivatives with PyTorch. I am programming some Gaussian processes, setting the hyperparameters by marginal likelihood and I was wondering if the derivatives can be taken automatically with PyTorch.

For instance a simple example would be computing the derivative of:

N=100
val=teta^2*numpy.eye(N)

The derivative is:

N=100
val=2*teta*numpy.eye(N)

Thanks