Something’s funny in your formula. You could either use PyTorch master, which includes a derivative for symeig or compare your own calculation with that which has been implemented in PyTorch:

  
      github.com
  
  
    pytorch/pytorch/blob/506142ac8aebe0b3794ba66d6d6c4019fc2182c8/tools/autograd/templates/Functions.cpp#L1544 14

  }
  v_term = u.mm(v_term);
} else {
  v_term = at::zeros({1}, self.type()).expand_as(self);
}


return u_term + sigma_term + v_term;
}


// http://eprints.maths.ox.ac.uk/1079/1/NA-08-01.pdf
Tensor symeig_backward(const std::vector<torch::autograd::Variable> &grads, const Tensor& self,
                  bool eigenvectors, bool upper, const Tensor& lambda, const Tensor& v) {
  auto glambda = grads[0];
  auto gv = grads[1];


  auto vt = v.t();


  if (!eigenvectors) {
      throw std::runtime_error(std::string("cannot compute backward without "
                                           "computing eigenvectors in forward pass"));
  }



  
  
    
    
  
  


Best regards
Thomas