1 | /**
|
2 | * @license
|
3 | * Copyright 2018 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 | */
|
17 | /// <amd-module name="@tensorflow/tfjs-core/dist/ops/pool" />
|
18 | import { Tensor3D, Tensor4D } from '../tensor';
|
19 | import { TensorLike } from '../types';
|
20 | import * as conv_util from './conv_util';
|
21 | /**
|
22 | * Performs an N-D pooling operation
|
23 | *
|
24 | * @param input The input tensor, of rank 4 or rank 3 of shape
|
25 | * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is assumed.
|
26 | * @param windowShape The filter size: `[filterHeight, filterWidth]`. If
|
27 | * `filterSize` is a single number, then `filterHeight == filterWidth`.
|
28 | * @param poolingType The type of pooling, either 'max' or 'avg'.
|
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 dilations The dilation rates: `[dilationHeight, dilationWidth]`
|
38 | * in which we sample input values across the height and width dimensions
|
39 | * in dilated pooling. Defaults to `[1, 1]`. If `dilationRate` is a single
|
40 | * number, then `dilationHeight == dilationWidth`. If it is greater than
|
41 | * 1, then all values of `strides` must be 1.
|
42 | * @param strides The strides of the pooling: `[strideHeight, strideWidth]`. If
|
43 | * `strides` is a single number, then `strideHeight == strideWidth`.
|
44 | *
|
45 | * @doc {heading: 'Operations', subheading: 'Convolution'}
|
46 | */
|
47 | declare function pool_<T extends Tensor3D | Tensor4D>(input: T | TensorLike, windowShape: [number, number] | number, poolingType: 'avg' | 'max', pad: 'valid' | 'same' | number | conv_util.ExplicitPadding, dilations?: [number, number] | number, strides?: [number, number] | number): T;
|
48 | export declare const pool: typeof pool_;
|
49 | export {};
|