Stay organized with collections
Save and categorize content based on your preferences.
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.
Args:
- 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.
Public attributes
Public functions
MaxPoolWithArgmax
MaxPoolWithArgmax(
const ::tensorflow::Scope & scope,
::tensorflow::Input input,
const gtl::ArraySlice< int > & ksize,
const gtl::ArraySlice< int > & strides,
StringPiece padding
)
Public static functions
IncludeBatchInIndex
Attrs IncludeBatchInIndex(
bool x
)
Targmax
Attrs Targmax(
DataType x
)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[],[],null,["# tensorflow::ops::MaxPoolWithArgmax Class Reference\n\ntensorflow::ops::MaxPoolWithArgmax\n==================================\n\n`#include \u003cnn_ops.h\u003e`\n\nPerforms max pooling on the input and outputs both max values and indices.\n\nSummary\n-------\n\nThe 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.\n\nThe 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.\n\nArgs:\n\n- scope: A [Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- input: 4-D with shape `[batch, height, width, channels]`. [Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input) to pool over.\n- ksize: The size of the window for each dimension of the input tensor.\n- strides: The stride of the sliding window for each dimension of the input tensor.\n- padding: The type of padding algorithm to use.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/max-pool-with-argmax/attrs#structtensorflow_1_1ops_1_1_max_pool_with_argmax_1_1_attrs)):\n\n- include_batch_in_index: Whether to include batch dimension in flattened index of `argmax`.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.14/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) output: The max pooled output tensor.\n- [Output](/versions/r2.14/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) argmax: 4-D. The flattened indices of the max values chosen for each output.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [MaxPoolWithArgmax](#classtensorflow_1_1ops_1_1_max_pool_with_argmax_1abb51fa41db084247e489859748d89eec)`(const ::`[tensorflow::Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, const gtl::ArraySlice\u003c int \u003e & ksize, const gtl::ArraySlice\u003c int \u003e & strides, StringPiece padding)` ||\n| [MaxPoolWithArgmax](#classtensorflow_1_1ops_1_1_max_pool_with_argmax_1a0c2a8005c65f80a0714ab13c31ac9b4a)`(const ::`[tensorflow::Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, const gtl::ArraySlice\u003c int \u003e & ksize, const gtl::ArraySlice\u003c int \u003e & strides, StringPiece padding, const `[MaxPoolWithArgmax::Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/max-pool-with-argmax/attrs#structtensorflow_1_1ops_1_1_max_pool_with_argmax_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|--------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [argmax](#classtensorflow_1_1ops_1_1_max_pool_with_argmax_1a3ee6b2270133581582b335bb54c206cd) | `::`[tensorflow::Output](/versions/r2.14/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [operation](#classtensorflow_1_1ops_1_1_max_pool_with_argmax_1ad70c7f4c8878ff933f05f49d914b32c5) | [Operation](/versions/r2.14/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_max_pool_with_argmax_1ae10e4e4c026e2fb47004e52ccae14cd5) | `::`[tensorflow::Output](/versions/r2.14/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public static functions ||\n|----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|\n| [IncludeBatchInIndex](#classtensorflow_1_1ops_1_1_max_pool_with_argmax_1a4e5f3eabc676bb9818da7a13ed74280d)`(bool x)` | [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/max-pool-with-argmax/attrs#structtensorflow_1_1ops_1_1_max_pool_with_argmax_1_1_attrs) |\n| [Targmax](#classtensorflow_1_1ops_1_1_max_pool_with_argmax_1a42ae4bbc217faf11615e6e2248886754)`(DataType x)` | [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/max-pool-with-argmax/attrs#structtensorflow_1_1ops_1_1_max_pool_with_argmax_1_1_attrs) |\n\n| ### Structs ||\n|---------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::MaxPoolWithArgmax::Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/max-pool-with-argmax/attrs) | Optional attribute setters for [MaxPoolWithArgmax](/versions/r2.14/api_docs/cc/class/tensorflow/ops/max-pool-with-argmax#classtensorflow_1_1ops_1_1_max_pool_with_argmax). |\n\nPublic attributes\n-----------------\n\n### argmax\n\n```text\n::tensorflow::Output argmax\n``` \n\n### operation\n\n```text\nOperation operation\n``` \n\n### output\n\n```text\n::tensorflow::Output output\n``` \n\nPublic functions\n----------------\n\n### MaxPoolWithArgmax\n\n```gdscript\n MaxPoolWithArgmax(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n const gtl::ArraySlice\u003c int \u003e & ksize,\n const gtl::ArraySlice\u003c int \u003e & strides,\n StringPiece padding\n)\n``` \n\n### MaxPoolWithArgmax\n\n```gdscript\n MaxPoolWithArgmax(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n const gtl::ArraySlice\u003c int \u003e & ksize,\n const gtl::ArraySlice\u003c int \u003e & strides,\n StringPiece padding,\n const MaxPoolWithArgmax::Attrs & attrs\n)\n``` \n\nPublic static functions\n-----------------------\n\n### IncludeBatchInIndex\n\n```text\nAttrs IncludeBatchInIndex(\n bool x\n)\n``` \n\n### Targmax\n\n```text\nAttrs Targmax(\n DataType x\n)\n```"]]