Gradient is the first derivative for functions of vectors, whereas hessian is the second derivative. We will go through the notation now:
Similar to the gradient, the hessian is defined only when f(x) is real-valued.
The following example shows the hessian implementation using TensorFlow:
import tensorflow as tfimport numpy as npX = tf.Variable(np.random.random_sample(), dtype=tf.float32)y = tf.Variable(np.random.random_sample(), dtype=tf.float32)def createCons(x): return tf.constant(x, dtype=tf.float32) ...