class_docstr: Creates a tensordot implementation from an einsum implementation.
class_docstr_tok: ["Creates","a","tensordot","implementation","from","an","einsum","implementation","."]
code: def __call__(self, x, y, axes=2):
      xnd = len(x.shape)
      ynd = len(y.shape)
  
      # convert int argument to (list[int], list[int])
      if isinstance(axes, int):
          axes = range(xnd - axes, xnd), range(axes)
  
      # convert (int, int) to (list[int], list[int])
      if isinstance(axes[0], int):
          axes = (axes[0],), axes[1]
      if isinstance(axes[1], int):
          axes = axes[0], (axes[1],)
  
      # initialize empty indices
      x_ix = [None] * xnd
      y_ix = [None] * ynd
      out_ix = []
  
      # fill in repeated indices
      available_ix = iter(EINSUM_SYMBOLS_BASE)
      for ax1, ax2 in zip(*axes):
          repeat = next(available_ix)
          x_ix[ax1] = repeat
          y_ix[ax2] = repeat
  
      # fill in the rest, and maintain output order
      for i in range(xnd):
          if x_ix[i] is None:
              leave = next(available_ix)
              x_ix[i] = leave
              out_ix.append(leave)
      for i in range(ynd):
          if y_ix[i] is None:
              leave = next(available_ix)
              y_ix[i] = leave
              out_ix.append(leave)
  
      # form full string and contract!
      einsum_str = "{},{}->{}".format(
          *map("".join, (x_ix, y_ix, out_ix))
      )
      return self.einsum(einsum_str, x, y)
  
imports: from funsor import ops
label_desc: Use image node_id 2 for calling the Tensordot obj's underlying member method code with example usage: obj.__call__(x, y, axes) and returns: self