static unsqueezeShape(dims, axes) {
        const outputDims = new Array(dims.length + axes.length);
        // initialize the array elements to 0
        outputDims.fill(0);
        // set all axes indices to 1 in outputDims and check for duplicates
        for (let i = 0; i < axes.length; i++) {
            const axis = ShapeUtil.normalizeAxis(axes[i], dims.length);
            if (axis >= outputDims.length) {
                throw new Error('\'axes\' has an out of range axis');
            }
            if (outputDims[axis] !== 0) {
                throw new Error('\'axes\' has a duplicate axis');
            }
            outputDims[axis] = 1;
        }
        // fill in the zero entries of outputDims with the input tensor's shape
        let inputDimsIterator = 0;
        for (let i = 0; i < outputDims.length; i++) {
            if (outputDims[i] === 0) {
                outputDims[i] = dims[inputDimsIterator++];
            }
        }
        // sanity check assertion. 'inputDimsIterator'
        // should be equal to the length of 'dims'
        if (inputDimsIterator !== dims.length) {
            throw new Error('the unsqueezed dimension could not be established');
        }
        return outputDims;
    }
/**
     * Determines the shape of output tensor y = unsqueeze(x, axes)
     * @param dims - shape of input tensor
     * @param axes - unsqueeze axes
     */
Determines the shape of output tensor y = unsqueeze(x, axes)
@param dims - shape of input tensor
@param axes - unsqueeze axes
Determines the shape of output tensor y = unsqueeze ( x axes ) @param dims - shape of input tensor @param axes - unsqueeze axes
static unsqueezeShape(dims, axes) {
        const outputDims = new Array(dims.length + axes.length);
        outputDims.fill(0);
        for (let i = 0; i < axes.length; i++) {
            const axis = ShapeUtil.normalizeAxis(axes[i], dims.length);
            if (axis >= outputDims.length) {
                throw new Error('\'axes\' has an out of range axis');
            }
            if (outputDims[axis] !== 0) {
                throw new Error('\'axes\' has a duplicate axis');
            }
            outputDims[axis] = 1;
        }
        let inputDimsIterator = 0;
        for (let i = 0; i < outputDims.length; i++) {
            if (outputDims[i] === 0) {
                outputDims[i] = dims[inputDimsIterator++];
            }
        }
        if (inputDimsIterator !== dims.length) {
            throw new Error('the unsqueezed dimension could not be established');
        }
        return outputDims;
    }
static unsqueezeShape ( dims , axes ) { const outputDims = new Array ( dims . length + axes . length ) ; outputDims . fill ( 0 ) ; for ( let i = 0 ; i < axes . length ; i ++ ) { const axis = ShapeUtil . normalizeAxis ( axes [ i ] , dims . length ) ; if ( axis >= outputDims . length ) { throw new Error ( '\'axes\' has an out of range axis' ) ; } if ( outputDims [ axis ] !== 0 ) { throw new Error ( '\'axes\' has a duplicate axis' ) ; } outputDims [ axis ] = 1 ; } let inputDimsIterator = 0 ; for ( let i = 0 ; i < outputDims . length ; i ++ ) { if ( outputDims [ i ] === 0 ) { outputDims [ i ] = dims [ inputDimsIterator ++ ] ; } } if ( inputDimsIterator !== dims . length ) { throw new Error ( 'the unsqueezed dimension could not be established' ) ; } return outputDims ; }
Determines the shape of output tensor y = unsqueeze(x, axes)
 @param dims - shape of input tensor
 @param axes - unsqueeze axes
Determines the shape of output tensor y = unsqueeze ( x axes ) @param dims - shape of input tensor @param axes - unsqueeze axes
// initialize the array elements to 0 // set all axes indices to 1 in outputDims and check for duplicates // fill in the zero entries of outputDims with the input tensor's shape // sanity check assertion. 'inputDimsIterator' // should be equal to the length of 'dims'