Tensor
Examples:
  >>> # trace
  >>> torch.einsum('ii', torch.randn(4, 4))
  tensor(-1.2104)

  >>> # diagonal
  >>> torch.einsum('ii->i', torch.randn(4, 4))
  tensor([-0.1034,  0.7952, -0.2433,  0.4545])

  >>> # outer product
  >>> x = torch.randn(5)
  >>> y = torch.randn(4)
  >>> torch.einsum('i,j->ij', x, y)
  tensor([[ 0.1156, -0.2897, -0.3918,  0.4963],
          [-0.3744,  0.9381,  1.2685, -1.6070],
          [ 0.7208, -1.8058, -2.4419,  3.0936],
          [ 0.1713, -0.4291, -0.5802,  0.7350],
          [ 0.5704, -1.4290, -1.9323,  2.4480]])

  >>> # batch matrix multiplication
  >>> As = torch.randn(3, 2, 5)
  >>> Bs = torch.randn(3, 5, 4)
  >>> torch.einsum('bij,bjk->bik', As, Bs)
  tensor([[[-1.0564, -1.5904,  3.2023,  3.1271],
          [-1.6706, -0.8097, -0.8025, -2.1183]],

          [[ 4.2239,  0.3107, -0.5756, -0.2354],
          [-1.4558, -0.3460,  1.5087, -0.8530]],
