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/max_pool_with_argmax" />
|
18 | import { Tensor4D } from '../tensor';
|
19 | import { NamedTensorMap } from '../tensor_types';
|
20 | import { TensorLike } from '../types';
|
21 | /**
|
22 | * Computes the 2D max pooling of an image with Argmax index.
|
23 | * The indices in argmax are flattened, so that a maximum value at position `[b,
|
24 | * y, x, c]` becomes flattened index: `(y * width + x) * channels + c` if
|
25 | * include_batch_in_index is False; `((b * height + y) * width + x) * channels
|
26 | * +c` if include_batch_in_index is True.
|
27 | *
|
28 | * The indices returned are always in `[0, height) x [0, width)` before
|
29 | * flattening.
|
30 | *
|
31 | * @param x The input tensor, of rank 4 or rank 3 of shape
|
32 | * `[batch, height, width, inChannels]`. If rank 3, batch of 1 is assumed.
|
33 | * @param filterSize The filter size: `[filterHeight, filterWidth]`. If
|
34 | * `filterSize` is a single number, then `filterHeight == filterWidth`.
|
35 | * @param strides The strides of the pooling: `[strideHeight, strideWidth]`. If
|
36 | * `strides` is a single number, then `strideHeight == strideWidth`.
|
37 | * @param dataFormat An optional string from: "NDHWC", "NCDHW". Defaults to
|
38 | * "NDHWC". Specify the data format of the input and output data. With the
|
39 | * default format "NDHWC", the data is stored in the order of: [batch,
|
40 | * depth, height, width, channels]. Only "NDHWC" is currently supported.
|
41 | * @param pad The type of padding algorithm.
|
42 | * - `same` and stride 1: output will be of same size as input,
|
43 | * regardless of filter size.
|
44 | * - `valid`: output will be smaller than input if filter is larger
|
45 | * than 1x1.
|
46 | * - For more info, see this guide:
|
47 | * [https://www.tensorflow.org/api_docs/python/tf/nn/convolution](
|
48 | * https://www.tensorflow.org/api_docs/python/tf/nn/convolution)
|
49 | * @param includeBatchIndex Defaults to False. Whether to include batch
|
50 | * dimension in flattened index of argmax.
|
51 | *
|
52 | * @doc {heading: 'Operations', subheading: 'Convolution'}
|
53 | */
|
54 | declare function maxPoolWithArgmax_<T extends Tensor4D>(x: T | TensorLike, filterSize: [number, number] | number, strides: [number, number] | number, pad: 'valid' | 'same' | number, includeBatchInIndex?: boolean): NamedTensorMap;
|
55 | export declare const maxPoolWithArgmax: typeof maxPoolWithArgmax_;
|
56 | export {};
|