code: def diff_ft(self, xt, yt):
          
          a, b = self.a, self.b 
          ex = np.exp(a + np.matmul(b, xt))  # shape = (dy,)
          grad = (-np.sum(ex[:, np.newaxis] * b, axis=0)
                  + np.sum(yt.flatten()[:, np.newaxis] * b, axis=0)) #TODO flatten
          hess = np.zeros((self.dx, self.dx))
          for k in range(self.dy):
              hess -= ex[k] * np.outer(b[k,:], b[k,:]) 
          return grad, hess
docs: First and second derivatives (wrt x_t) of log-density of Y_t|X_t=xt