UNPKG

3.52 kBTypeScriptView Raw
1/// <amd-module name="@tensorflow/tfjs-core/dist/ops/separable_conv2d" />
2/**
3 * @license
4 * Copyright 2020 Google LLC. All Rights Reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 * =============================================================================
17 */
18import { Tensor3D, Tensor4D } from '../tensor';
19import { TensorLike } from '../types';
20/**
21 * 2-D convolution with separable filters.
22 *
23 * Performs a depthwise convolution that acts separately on channels followed
24 * by a pointwise convolution that mixes channels. Note that this is
25 * separability between dimensions [1, 2] and 3, not spatial separability
26 * between dimensions 1 and 2.
27 *
28 * See
29 * [https://www.tensorflow.org/api_docs/python/tf/nn/separable_conv2d](
30 * https://www.tensorflow.org/api_docs/python/tf/nn/separable_conv2d)
31 * for more details.
32 *
33 * @param x The input tensor, of rank 4 or rank 3, of shape
34 * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is
35 * assumed.
36 * @param depthwiseFilter The depthwise filter tensor, rank 4, of shape
37 * `[filterHeight, filterWidth, inChannels, channelMultiplier]`. This is
38 * the filter used in the first step.
39 * @param pointwiseFilter The pointwise filter tensor, rank 4, of shape
40 * `[1, 1, inChannels * channelMultiplier, outChannels]`. This is
41 * the filter used in the second step.
42 * @param strides The strides of the convolution: `[strideHeight,
43 * strideWidth]`. If strides is a single number, then `strideHeight ==
44 * strideWidth`.
45 * @param pad The type of padding algorithm.
46 * - `same` and stride 1: output will be of same size as input,
47 * regardless of filter size.
48 * - `valid`: output will be smaller than input if filter is larger
49 * than 1x1.
50 * - For more info, see this guide:
51 * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](
52 * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)
53 * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`
54 * in which we sample input values across the height and width dimensions
55 * in atrous convolution. Defaults to `[1, 1]`. If `rate` is a single
56 * number, then `dilationHeight == dilationWidth`. If it is greater than
57 * 1, then all values of `strides` must be 1.
58 * @param dataFormat: An optional string from: "NHWC", "NCHW". Defaults to
59 * "NHWC". Specify the data format of the input and output data. With the
60 * default format "NHWC", the data is stored in the order of: [batch,
61 * height, width, channels]. Only "NHWC" is currently supported.
62 *
63 * @doc {heading: 'Operations', subheading: 'Convolution'}
64 */
65declare function separableConv2d_<T extends Tensor3D | Tensor4D>(x: T | TensorLike, depthwiseFilter: Tensor4D | TensorLike, pointwiseFilter: Tensor4D | TensorLike, strides: [number, number] | number, pad: 'valid' | 'same', dilation?: [number, number] | number, dataFormat?: 'NHWC' | 'NCHW'): T;
66export declare const separableConv2d: typeof separableConv2d_;
67export {};