UNPKG

2.18 kBTypeScriptView Raw
1/// <amd-module name="@tensorflow/tfjs-core/dist/ops/conv2d" />
2import { Tensor3D, Tensor4D } from '../tensor';
3import { TensorLike } from '../types';
4import * as conv_util from './conv_util';
5/**
6 * Computes a 2D convolution over the input x.
7 *
8 * @param x The input tensor, of rank 4 or rank 3, of shape
9 * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is
10 * assumed.
11 * @param filter The filter, rank 4, of shape
12 * `[filterHeight, filterWidth, inDepth, outDepth]`.
13 * @param strides The strides of the convolution: `[strideHeight,
14 * strideWidth]`.
15 * @param pad The type of padding algorithm.
16 * - `same` and stride 1: output will be of same size as input,
17 * regardless of filter size.
18 * - `valid`: output will be smaller than input if filter is larger
19 * than 1x1.
20 * - For more info, see this guide:
21 * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](
22 * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)
23 * @param dataFormat: An optional string from: "NHWC", "NCHW". Defaults to
24 * "NHWC". Specify the data format of the input and output data. With the
25 * default format "NHWC", the data is stored in the order of: [batch,
26 * height, width, channels].
27 * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`
28 * in which we sample input values across the height and width dimensions
29 * in atrous convolution. Defaults to `[1, 1]`. If `dilations` is a single
30 * number, then `dilationHeight == dilationWidth`. If it is greater than
31 * 1, then all values of `strides` must be 1.
32 * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is
33 * provided, it will default to truncate.
34 *
35 * @doc {heading: 'Operations', subheading: 'Convolution'}
36 */
37declare function conv2d_<T extends Tensor3D | Tensor4D>(x: T | TensorLike, filter: Tensor4D | TensorLike, strides: [number, number] | number, pad: 'valid' | 'same' | number | conv_util.ExplicitPadding, dataFormat?: 'NHWC' | 'NCHW', dilations?: [number, number] | number, dimRoundingMode?: 'floor' | 'round' | 'ceil'): T;
38export declare const conv2d: typeof conv2d_;
39export {};