node_modules/@tensorflow/tfjs-layers/dist/layers/convolutional_depthwise.js
/**
 * 2D convolution with separable filters.
 * @param x Input tensor.
 * @param depthwiseKernel Convolution kernel for depthwise convolution.
 * @param strides Strides (Array of two integers).
 * @param padding Padding model.
 * @param dataFormat Data format.
 * @param dilationRate Array of two integers, dilation rates for the separable
 *   convolution.
 * @returns Output tensor.
 * @throws ValueError If depthwiseKernel is not a 4D array.
 */
2D convolution with separable filters.
@param x Input tensor.
@param depthwiseKernel Convolution kernel for depthwise convolution.
@param strides Strides (Array of two integers).
@param padding Padding model.
@param dataFormat Data format.
@param dilationRate Array of two integers, dilation rates for the separable
convolution.
@returns Output tensor.
@throws ValueError If depthwiseKernel is not a 4D array.
2D convolution with separable filters . @param x Input tensor . @param depthwiseKernel Convolution kernel for depthwise convolution . @param strides Strides ( Array of two integers ) . @param padding Padding model . @param dataFormat Data format . @param dilationRate Array of two integers dilation rates for the separable convolution . @returns Output tensor . @throws ValueError If depthwiseKernel is not a 4D array .
function depthwiseConv2d(x, depthwiseKernel, strides, padding, dataFormat, dilationRate) {
    if (strides === void 0) { strides = [1, 1]; }
    if (padding === void 0) { padding = 'valid'; }
    return tfjs_core_1.tidy(function () {
        if (dataFormat == null) {
            dataFormat = common_1.imageDataFormat();
        }
        common_2.checkDataFormat(dataFormat);
        var y = convolutional_1.preprocessConv2DInput(x, dataFormat);
        if (x.rank !== 4) {
            throw new errors_1.ValueError("Input for depthwiseConv2d is required to be 4-D, but is instead " +
                (x.rank + "-D"));
        }
        if (depthwiseKernel.rank !== 4) {
            throw new errors_1.ValueError("depthwiseKernel is required to be 4-D, but is instead " +
                (depthwiseKernel.rank + "-D"));
        }
        y = tfc.depthwiseConv2d(y, depthwiseKernel, strides, padding === 'same' ? 'same' : 'valid', 'NHWC', dilationRate);
        if (dataFormat === 'channelsFirst') {
            y = tfc.transpose(y, [0, 3, 1, 2]);
        }
        return y;
    });
}
function depthwiseConv2d ( x , depthwiseKernel , strides , padding , dataFormat , dilationRate ) { if ( strides === void 0 ) { strides = [ 1 , 1 ] ; } if ( padding === void 0 ) { padding = 'valid' ; } return tfjs_core_1 . tidy ( function ( ) { if ( dataFormat == null ) { dataFormat = common_1 . imageDataFormat ( ) ; } common_2 . checkDataFormat ( dataFormat ) ; var y = convolutional_1 . preprocessConv2DInput ( x , dataFormat ) ; if ( x . rank !== 4 ) { throw new errors_1 . ValueError ( "Input for depthwiseConv2d is required to be 4-D, but is instead " + ( x . rank + "-D" ) ) ; } if ( depthwiseKernel . rank !== 4 ) { throw new errors_1 . ValueError ( "depthwiseKernel is required to be 4-D, but is instead " + ( depthwiseKernel . rank + "-D" ) ) ; } y = tfc . depthwiseConv2d ( y , depthwiseKernel , strides , padding === 'same' ? 'same' : 'valid' , 'NHWC' , dilationRate ) ; if ( dataFormat === 'channelsFirst' ) { y = tfc . transpose ( y , [ 0 , 3 , 1 , 2 ] ) ; } return y ; } ) ; }
2D convolution with separable filters.
2D convolution with separable filters .