function calc_squeeze_dims(dims, dim) {
    dims = dims.slice();
    if (dim === null) {
        dims = dims.filter((d) => d !== 1);
    } else if (typeof dim === 'number') {
        if (dims[dim] === 1) {
            dims.splice(dim, 1);
        }
    } else if (Array.isArray(dim)) {
        dims = dims.filter((x, i) => {
            return x !== 1 || !dim.includes(i);
        });
    }
    return dims;
}
Helper function to calculate new dimensions when performing a squeeze operation.
@param {number[]} dims The dimensions of the tensor.
@param {number|number[]|null} dim The dimension(s) to squeeze.
@returns {number[]} The new dimensions.
@private