function decodeEinsumEquation(equation, numTensors) {
    equation = equation.replace(/\s/g, ""); // Remove witespace in equation.
    const numArrows = (equation.length - equation.replace(ARROW_REGEX, "").length) / ARROW.length;
    if (numArrows < 1) throw new Error("Equations without an arrow are not supported.");
    else if (numArrows > 1) throw new Error(`Equation must contain exactly one arrow ("${ARROW}").`);
    const [inputString, outputString] = equation.split(ARROW);
    (0, _utilBase.assert)(inputString.indexOf(ELLIPSIS) === -1, ()=>`The ellipsis notation ("${ELLIPSIS}") is not supported yet.`);
    const inputTerms = inputString.split(COMMA);
    const numInputs = inputTerms.length;
    if (numTensors !== numInputs) throw new Error(`Expected ${numInputs} input tensors, received ${numTensors}`);
    if (numInputs > 2) throw new Error("Support for more than 2 input tensors is not implemented yet.");
    const allDims = [];
    for(let i = 0; i < outputString.length; ++i){
        const dimName = outputString[i];
        if (!inputTerms.some((inputTerm)=>inputTerm.indexOf(dimName) !== -1)) throw new Error(`Output subscripts contain the label ${dimName} ` + `not present in the input subscripts.`);
        if (allDims.indexOf(dimName) === -1) allDims.push(dimName);
    }
    for(let i = 0; i < inputString.length; ++i){
        const dimName = inputString[i];
        if (allDims.indexOf(dimName) === -1 && dimName !== COMMA) allDims.push(dimName);
    }
    const idDims = new Array(inputTerms.length);
    for(let i = 0; i < numInputs; ++i){
        if (new Set(inputTerms[i].split("")).size !== inputTerms[i].length) throw new Error(`Found duplicate axes in input component ${inputTerms[i]}. ` + `Support for duplicate axes in input is not implemented yet.`);
        idDims[i] = [];
        for(let j = 0; j < inputTerms[i].length; ++j)idDims[i].push(allDims.indexOf(inputTerms[i][j]));
    }
    const numDims = allDims.length; // Number of unique dimensions.
    const numOutDims = outputString.length; // Number of output dimensions.
    const summedDims = []; // Dimensions being summed over.
    for(let i = numOutDims; i < numDims; ++i)summedDims.push(i);
    return {
        allDims,
        summedDims,
        idDims
    };
}
Determines if an axes permutation is the identity permutation.