UNPKG

2.26 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 */
17/// <amd-module name="@tensorflow/tfjs-core/dist/ops/avg_pool" />
18import { Tensor3D, Tensor4D } from '../tensor';
19import { TensorLike } from '../types';
20import * as conv_util from './conv_util';
21/**
22 * Computes the 2D average pooling of an image.
23 *
24 * @param x 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 filterSize The filter size: `[filterHeight, filterWidth]`. If
27 * `filterSize` is a single number, then `filterHeight == filterWidth`.
28 * @param strides The strides of the pooling: `[strideHeight, strideWidth]`. If
29 * `strides` is a single number, then `strideHeight == strideWidth`.
30 * @param pad The type of padding algorithm:
31 * - `same` and stride 1: output will be of same size as input,
32 * regardless of filter size.
33 * - `valid`: output will be smaller than input if filter is larger
34 * than 1x1.
35 * - For more info, see this guide:
36 * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](
37 * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)
38 * @param dimRoundingMode A string from: 'ceil', 'round', 'floor'. If none is
39 * provided, it will default to truncate.
40 */
41declare function avgPool_<T extends Tensor3D | Tensor4D>(x: T | TensorLike, filterSize: [number, number] | number, strides: [number, number] | number, pad: 'valid' | 'same' | number | conv_util.ExplicitPadding, dimRoundingMode?: 'floor' | 'round' | 'ceil'): T;
42export declare const avgPool: typeof avgPool_;
43export {};