tensorflow::ops::MaxPoolWithArgmax
#include <nn_ops.h>
Performs max pooling on the input and outputs both max values and indices.
Summary
The indices in argmax
are flattened, so that a maximum value at position [b, y, x, c]
becomes flattened index: (y * width + x) * channels + c
if include_batch_in_index
is False; ((b * height + y) * width + x) * channels + c
if include_batch_in_index
is True.
The indices returned are always in [0, height) x [0, width)
before flattening, even if padding is involved and the mathematically correct answer is outside (either negative or too large). This is a bug, but fixing it is difficult to do in a safe backwards compatible way, especially due to flattening.
Arguments:
- scope: A Scope object
- input: 4-D with shape
[batch, height, width, channels]
. Input to pool over. - ksize: The size of the window for each dimension of the input tensor.
- strides: The stride of the sliding window for each dimension of the input tensor.
- padding: The type of padding algorithm to use.
Optional attributes (see Attrs
):
- include_batch_in_index: Whether to include batch dimension in flattened index of
argmax
.
Returns:
-
Output
output: The max pooled output tensor. -
Output
argmax: 4-D. The flattened indices of the max values chosen for each output.
Constructors and Destructors | |
---|---|
MaxPoolWithArgmax(const ::tensorflow::Scope & scope, ::tensorflow::Input input, const gtl::ArraySlice< int > & ksize, const gtl::ArraySlice< int > & strides, StringPiece padding) | |
MaxPoolWithArgmax(const ::tensorflow::Scope & scope, ::tensorflow::Input input, const gtl::ArraySlice< int > & ksize, const gtl::ArraySlice< int > & strides, StringPiece padding, const MaxPoolWithArgmax::Attrs & attrs) |
Public attributes | |
---|---|
argmax | |
operation | |
output |
Public static functions | |
---|---|
IncludeBatchInIndex(bool x) | |
Targmax(DataType x) |
Structs | |
---|---|
tensorflow::ops::MaxPoolWithArgmax::Attrs | Optional attribute setters for MaxPoolWithArgmax. |
Public attributes
argmax
::tensorflow::Output argmax
operation
Operation operation
output
::tensorflow::Output output
Public functions
MaxPoolWithArgmax
MaxPoolWithArgmax( const ::tensorflow::Scope & scope, ::tensorflow::Input input, const gtl::ArraySlice< int > & ksize, const gtl::ArraySlice< int > & strides, StringPiece padding )
MaxPoolWithArgmax
MaxPoolWithArgmax( const ::tensorflow::Scope & scope, ::tensorflow::Input input, const gtl::ArraySlice< int > & ksize, const gtl::ArraySlice< int > & strides, StringPiece padding, const MaxPoolWithArgmax::Attrs & attrs )
Public static functions
IncludeBatchInIndex
Attrs IncludeBatchInIndex( bool x )
Targmax
Attrs Targmax( DataType x )
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/cc/class/tensorflow/ops/max-pool-with-argmax