code: def dot_adjoint_1(A, G, A_meta, B_meta):
      _, A_ndim, _, _ = A_meta
      _, B_ndim, B_dtype, _ = B_meta
      needs_transpose = B_ndim > 1 and A_ndim != 0
      swap = (
          (lambda x: onp.swapaxes(x, -1, -2))
          if needs_transpose
          else (lambda x: x)
      )
      if A_ndim == 0 or A_ndim == 1 or B_ndim == 0:
          contract_num = max(0, A_ndim - (B_ndim != 0))
          out = swap(onp.tensordot(G, A, contract_num))
      else:
          out = swap(
              onp.tensordot(
                  G,
                  A,
                  [
                      range(-A_ndim - B_ndim + 2, -B_ndim + 1),
                      range(A_ndim - 1),
                  ],
              )
          )
      return onp.asarray(out, dtype=B_dtype)
  
imports: from __future__ import absolute_import
  from six import string_types
  from functools import partial
  import numpy
  from ..util import func
  from .None import numpy_wrapper
  from .numpy_boxes import ArrayBox
  from autograd.extend import primitive, vspace, defvjp, defvjp_argnum, SparseObject, VJPNode, register_notrace
label_desc: Use image node_id 24 for calling a global function with example usage: dot_adjoint_1(A, G, A_meta, B_meta) and returns: onp