I’ve been working on doing exactly that by adding functionality to sympy that allows reasoning about pytorch tensors.
I’ve documented a few examples here:

  
      
      GitHub
  
  
    

Zer0Credibility/symtorch 62

Initial Commit. Contribute to Zer0Credibility/symtorch development by creating an account on GitHub.