node_modules/@tensorflow/tfjs-data/dist/tf-data.js
/** Reduces the shape by removing all dimensions of shape 1. */
Reduces the shape by removing all dimensions of shape 1.
Reduces the shape by removing all dimensions of shape 1 .
function squeezeShape(shape, axis) {
        var newShape = [];
        var keptDims = [];
        var axes = axis == null ? null : parseAxisParam(axis, shape).sort();
        var j = 0;
        for (var i = 0; i < shape.length; ++i) {
            if (axes != null) {
                if (axes[j] === i && shape[i] !== 1) {
                    throw new Error("Can't squeeze axis " + i + " since its dim '" + shape[i] + "' is not 1");
                }
                if ((axes[j] == null || axes[j] > i) && shape[i] === 1) {
                    newShape.push(shape[i]);
                    keptDims.push(i);
                }
                if (axes[j] <= i) {
                    j++;
                }
            }
            if (shape[i] !== 1) {
                newShape.push(shape[i]);
                keptDims.push(i);
            }
        }
        return { newShape: newShape, keptDims: keptDims };
    }
function squeezeShape ( shape , axis ) { var newShape = [ ] ; var keptDims = [ ] ; var axes = axis == null ? null : parseAxisParam ( axis , shape ) . sort ( ) ; var j = 0 ; for ( var i = 0 ; i < shape . length ; ++ i ) { if ( axes != null ) { if ( axes [ j ] === i && shape [ i ] !== 1 ) { throw new Error ( "Can't squeeze axis " + i + " since its dim '" + shape [ i ] + "' is not 1" ) ; } if ( ( axes [ j ] == null || axes [ j ] > i ) && shape [ i ] === 1 ) { newShape . push ( shape [ i ] ) ; keptDims . push ( i ) ; } if ( axes [ j ] <= i ) { j ++ ; } } if ( shape [ i ] !== 1 ) { newShape . push ( shape [ i ] ) ; keptDims . push ( i ) ; } } return { newShape : newShape , keptDims : keptDims } ; }
Reduces the shape by removing all dimensions of shape 1.
Reduces the shape by removing all dimensions of shape 1 .