UNPKG

2.51 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2020 Google LLC. All Rights Reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 * =============================================================================
16 */
17import { Tensor2D, Tensor3D } from '../tensor';
18import { TensorLike } from '../types';
19import * as conv_util from './conv_util';
20/**
21 * Computes a 1D convolution over the input x.
22 *
23 * @param x The input tensor, of rank 3 or rank 2, of shape
24 * `[batch, width, inChannels]`. If rank 2, batch of 1 is assumed.
25 * @param filter The filter, rank 3, of shape
26 * `[filterWidth, inDepth, outDepth]`.
27 * @param stride The number of entries by which the filter is moved right at
28 * each step.
29 * @param pad The type of padding algorithm.
30 * - `same` and stride 1: output will be of same size as input,
31 * regardless of filter size.
32 * - `valid`: output will be smaller than input if filter is larger
33 * than 1x1.
34 * - For more info, see this guide:
35 * [https://www.tensorflow.org/api_guides/python/nn#Convolution](
36 * https://www.tensorflow.org/api_guides/python/nn#Convolution)
37 * @param dataFormat An optional string from "NWC", "NCW". Defaults to "NWC",
38 * the data is stored in the order of [batch, in_width, in_channels]. Only
39 * "NWC" is currently supported.
40 * @param dilation The dilation rate in which we sample input values in
41 * atrous convolution. Defaults to `1`. If it is greater than 1, then
42 * stride must be `1`.
43 * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is
44 * provided, it will default to truncate.
45 *
46 * @doc {heading: 'Operations', subheading: 'Convolution'}
47 */
48declare function conv1d_<T extends Tensor2D | Tensor3D>(x: T | TensorLike, filter: Tensor3D | TensorLike, stride: number, pad: 'valid' | 'same' | number | conv_util.ExplicitPadding, dataFormat?: 'NWC' | 'NCW', dilation?: number, dimRoundingMode?: 'floor' | 'round' | 'ceil'): T;
49export declare const conv1d: typeof conv1d_;
50export {};