code: def hessian(func, func_out_ndim=0):
      """Return a function that returns the hessian of func.
  
      Parameters
      ----------
      func : callable
          Function whose Hessian is computed.
      func_out_ndim : dim
          func output ndim.
  
      Returns
      -------
      _ : callable
          Function taking point as input and returning
          the hessian of func at point.
      """
  
      def _hessian(point):
          return _torch_hessian(
              func=lambda x: func(x), inputs=point, strict=True
          )
  
      def _hessian_vector_valued(point):
          def scalar_func(point, a):
              return func(point)[a]
  
          return _torch.stack(
              [
                  hessian(functools.partial(scalar_func, a=a))(point)
                  for a in range(func_out_ndim)
              ]
          )
  
      if func_out_ndim:
          return _hessian_vector_valued
  
      return _hessian
  
file_path: geomstats/geomstats/_backend/pytorch/autodiff.py
imports: import functools
  import numpy
  import torch
  from torch.autograd.functional import hessian
  from torch.autograd.functional import jacobian
label_desc: Use image node_id 4 for calling a global function with example usage: hessian(func, func_out_ndim) and returns: _hessian, _torch_hessian, _torch, _hessian_vector_valued, func