title: Using sympy to take the jacobian wrt symbolic matrix of a function that returns a scalar
body: <p>I am trying to take the jacobian of a scalar function with respect to a matrix</p>
  
  <pre><code>w = sym.MatrixSymbol('w',2,1)
  g = sym.Matrix([sym.log(1 + sym.exp(sym.MatMul(w.T,w)))])
  grad_g = g.jacobian(w)
  </code></pre>
  
  <p>this returns a jacobian vector of <code>[0,0]</code> which is incorrect.</p>
  
  <p>I attempted a non-symbollic implementation here:</p>
  
  <pre><code>w1, w2 = sym.symbols('w_1, w_2')
  w = sym.Matrix([w1, w2])
  g = sym.Matrix([sym.log(sym.Matrix([1]) + sym.exp(w.T * w))])
  grad_g = g.jacobian(w)
  </code></pre>
  
  <p>where I get an error that says: <code>NotImplementedError:</code> with 0 further information. </p>
  
  <p>Would love any and all help!</p>