UNPKG

2.47 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 { Tensor3D, Tensor4D } from '../tensor';
18import { TensorLike } from '../types';
19/**
20 * Computes the 2D max pooling of an image.
21 *
22 * @param x The input tensor, of rank 4 or rank 3 of shape
23 * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is assumed.
24 * @param filterSize The filter size: `[filterHeight, filterWidth]`. If
25 * `filterSize` is a single number, then `filterHeight == filterWidth`.
26 * @param strides The strides of the pooling: `[strideHeight, strideWidth]`. If
27 * `strides` is a single number, then `strideHeight == strideWidth`.
28 * @param dilations The dilation rates: `[dilationHeight, dilationWidth]`
29 * in which we sample input values across the height and width dimensions
30 * in dilated pooling. Defaults to `[1, 1]`. If `dilations` is a single
31 * number, then `dilationHeight == dilationWidth`. If it is greater than
32 * 1, then all values of `strides` must be 1.
33 * @param pad The type of padding algorithm.
34 * - `same` and stride 1: output will be of same size as input,
35 * regardless of filter size.
36 * - `valid`: output will be smaller than input if filter is larger
37 * than 1x1.
38 * - For more info, see this guide:
39 * [https://www.tensorflow.org/api_guides/python/nn#Convolution](
40 * https://www.tensorflow.org/api_guides/python/nn#Convolution)
41 * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is
42 * provided, it will default to truncate.
43 */
44declare function maxPool_<T extends Tensor3D | Tensor4D>(x: T | TensorLike, filterSize: [number, number] | number, strides: [number, number] | number, pad: 'valid' | 'same' | number, dimRoundingMode?: 'floor' | 'round' | 'ceil'): T;
45export declare const maxPool: typeof maxPool_;
46export {};