code: def _adjoint(_ans, x, fn):
      vectorized = x.ndim == 3
      axes = (0, 2, 1) if vectorized else (1, 0)
  
      def vjp(g):
          n = x.shape[-1]
          size_m = x.shape[:-2] + (2 * n, 2 * n)
          mat = _np.zeros(size_m)
          mat[..., :n, :n] = x.transpose(axes)
          mat[..., n:, n:] = x.transpose(axes)
          mat[..., :n, n:] = g
          return fn(mat)[..., :n, n:]
  
      return vjp
  
file_path: geomstats/geomstats/_backend/autograd/linalg.py
imports: import functools
  import autograd.numpy
  from autograd.extend import defvjp
  from autograd.extend import primitive
  from autograd.numpy.linalg import cholesky, det, eig, eigh, eigvalsh, inv, matrix_rank, norm, solve, svd
  from autograd.scipy.linalg import expm
  from .._shared_numpy.linalg import fractional_matrix_power, is_single_matrix_pd
  from .._shared_numpy.linalg import logm
  from .._shared_numpy.linalg import qr, quadratic_assignment, solve_sylvester, sqrtm
label_desc: Use image node_id 1 for calling a global function with example usage: _adjoint(_ans, x, fn) and returns: vjp, fn