jax-js
    Preparing search index...

    Function einsum

    Einstein summation.

    This is a general API for performing tensor reductions, products, transpositions, and traces using Einstein notation for referring to named axes. See the docs for numpy.einsum() for more information.

    https://numpy.org/doc/stable/reference/generated/numpy.einsum.html

    The full einsum API is implemented, including implicit and explicit output indices, ellipsis broadcasting, Unicode subscripts, and an optimal path ordering algorithm. It lowers to one or more calls to:

    • jax.lax.dot()
    • jax.numpy.diagonal()
    • jax.numpy.sum()
    • jax.numpy.transpose()
    • Einstein summation with string subscripts.

      Parameters

      Returns Array

      import { numpy as np } from "@jax-js/jax";

      const a = np.ones([2, 3]);
      const b = np.ones([3]);
      np.einsum("ij,j", a, b); // Shape [2]
    • Einstein summation alternating between arrays and numeric indices.

      Parameters

      Returns Array

      import { numpy as np } from "@jax-js/jax";

      const a = np.ones([2, 3]);
      const b = np.ones([3]);
      np.einsum(a, [0, 1], b, [1]); // Shape [2]