node_modules/@tensorflow/tfjs-layers/dist/initializers.js
/**
 * Computes the number of input and output units for a weight shape.
 * @param shape Shape of weight.
 * @param dataFormat data format to use for convolution kernels.
 *   Note that all kernels in Keras are standardized on the
 *   CHANNEL_LAST ordering (even when inputs are set to CHANNEL_FIRST).
 * @return An length-2 array: fanIn, fanOut.
 */
Computes the number of input and output units for a weight shape.
@param shape Shape of weight.
@param dataFormat data format to use for convolution kernels.
Note that all kernels in Keras are standardized on the
CHANNEL_LAST ordering (even when inputs are set to CHANNEL_FIRST).
@return An length-2 array: fanIn, fanOut.
Computes the number of input and output units for a weight shape . @param shape Shape of weight . @param dataFormat data format to use for convolution kernels . Note that all kernels in Keras are standardized on the CHANNEL_LAST ordering ( even when inputs are set to CHANNEL_FIRST ) . @return An length - 2 array : fanIn fanOut .
function computeFans(shape, dataFormat) {
    if (dataFormat === void 0) { dataFormat = 'channelsLast'; }
    var fanIn;
    var fanOut;
    common_1.checkDataFormat(dataFormat);
    if (shape.length === 2) {
        fanIn = shape[0];
        fanOut = shape[1];
    }
    else if ([3, 4, 5].indexOf(shape.length) !== -1) {
        if (dataFormat === 'channelsFirst') {
            var receptiveFieldSize = math_utils_1.arrayProd(shape, 2);
            fanIn = shape[1] * receptiveFieldSize;
            fanOut = shape[0] * receptiveFieldSize;
        }
        else if (dataFormat === 'channelsLast') {
            var receptiveFieldSize = math_utils_1.arrayProd(shape, 0, shape.length - 2);
            fanIn = shape[shape.length - 2] * receptiveFieldSize;
            fanOut = shape[shape.length - 1] * receptiveFieldSize;
        }
    }
    else {
        var shapeProd = math_utils_1.arrayProd(shape);
        fanIn = Math.sqrt(shapeProd);
        fanOut = Math.sqrt(shapeProd);
    }
    return [fanIn, fanOut];
}
function computeFans ( shape , dataFormat ) { if ( dataFormat === void 0 ) { dataFormat = 'channelsLast' ; } var fanIn ; var fanOut ; common_1 . checkDataFormat ( dataFormat ) ; if ( shape . length === 2 ) { fanIn = shape [ 0 ] ; fanOut = shape [ 1 ] ; } else if ( [ 3 , 4 , 5 ] . indexOf ( shape . length ) !== - 1 ) { if ( dataFormat === 'channelsFirst' ) { var receptiveFieldSize = math_utils_1 . arrayProd ( shape , 2 ) ; fanIn = shape [ 1 ] * receptiveFieldSize ; fanOut = shape [ 0 ] * receptiveFieldSize ; } else if ( dataFormat === 'channelsLast' ) { var receptiveFieldSize = math_utils_1 . arrayProd ( shape , 0 , shape . length - 2 ) ; fanIn = shape [ shape . length - 2 ] * receptiveFieldSize ; fanOut = shape [ shape . length - 1 ] * receptiveFieldSize ; } } else { var shapeProd = math_utils_1 . arrayProd ( shape ) ; fanIn = Math . sqrt ( shapeProd ) ; fanOut = Math . sqrt ( shapeProd ) ; } return [ fanIn , fanOut ] ; }
Computes the number of input and output units for a weight shape.
Computes the number of input and output units for a weight shape .