code: def find_hessian_and_gradient(error_function, parameters):
      """
      Compute hessian matrix and gradient vector.
  
      Parameters
      ----------
      error_function : Tensor
  
      parameters : list of Tensorfow variable
          Neural network parameters (e.g. weights, biases).
  
      Returns
      -------
      Tensorfow variable
      """
      gradients = tf.gradients(error_function, parameters)
      full_gradient = make_single_vector(gradients)
  
      full_gradient_shape = tf.shape(full_gradient)
      n_samples = full_gradient_shape[0]
  
      def compute_gradient_per_value(index, result):
          gradients = tf.gradients(full_gradient[index], parameters)
          hessian = make_single_vector(gradients)
          return (index + 1, result.write(index, hessian))
  
      _, hessian = tf.while_loop(
          lambda index, _: index < n_samples,
          compute_gradient_per_value,
          [
              tf.constant(0, tf.int32),
              tf.TensorArray(tf.float32, size=n_samples),
          ],
      )
  
      return hessian.stack(), full_gradient
  
file_path: neupy/neupy/algorithms/gd/hessian.py
imports: import tensorflow
  from neupy.core.properties import BoundedProperty, WithdrawProperty
  from neupy.utils import asfloat, flatten, function_name_scope, make_single_vector
  from neupy.utils.tf_utils import setup_parameter_updates
  from .base import BaseOptimizer
label_desc: Use image node_id 1 for calling a global function with example usage: find_hessian_and_gradient(error_function, parameters) and returns: hessian,  full_gradient, unknown,  result