max_pool.rst 3.09 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
.. max_pool.rst:

#######
MaxPool
#######

.. code-block:: cpp

   MaxPool  // MaxPool operations


Description
===========

Batched max pooling operation, with optional padding and window
stride.

Inputs
------

+-----------------+-------------------------+----------------------------------+
| Name            | Element Type            | Shape                            |
+=================+=========================+==================================+
| ``arg``         | any                     | :math:`(N, C, d_1, \ldots, d_n)` |
+-----------------+-------------------------+----------------------------------+

Attributes
----------

+-------------------------------+-----------------------------------------------+
| Name                          | Description                                   |
+===============================+===============================================+
| ``window_shape``              | The window shape.                             |
+-------------------------------+-----------------------------------------------+
| ``window_movement_strides``   | The window movement strides. (defaults to 1s) |
+-------------------------------+-----------------------------------------------+
| ``padding_below``             | The below-padding shape. (defaults to 0s)     |
+-------------------------------+-----------------------------------------------+
| ``padding_above``             | The above-padding shape. (defaults to 0s)     |
+-------------------------------+-----------------------------------------------+


Outputs
-------

+-----------------+-------------------------+--------------------------------+
| Name            | Element Type            | Shape                          |
+=================+=========================+================================+
| ``output``      | same as ``arg``         | :math:`(N,C,d'_1,\ldots,d'_n)` |
+-----------------+-------------------------+--------------------------------+

The input for max pooling is a data batch tensor of shape
:math:`(N,C,d_1,\dots,d_n)` where :math:`n > 0`, every :math:`d_i >
0`, and where :math:`N` is the batch size, and :math:`C > 0` is the
number of channels (sometimes called features).  The dimensions
Scott Cyphers's avatar
Scott Cyphers committed
56
:math:`(d_1,\dots,d_n)` correspond to the shape of an
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
:math:`n`-dimensional data item in a batch. For example, where
:math:`n=2`, the data may represent a two-dimensional image.  It also
has two attributes:

1. *the window shape* a size vector :math:`(w_1,\ldots,w_n)` where every :math:`w_i \le d_i`; and
2. *the window movement strides, optional* a vector of positive integers :math:`(s_1,\dots,s_n)`.

The output has the shape :math:`(N,C,d'_1,\ldots,d'_n)`, where :math:`d'_n = \lceil \frac{d_i - w_i + 1}{s_i} \rceil`.


Mathematical Definition
=======================

Given an input data batch tensor :math:`T_{in}`, the output tensor is defined by the equation

.. math::

        T_{out}[a,c,i_1,\dots,i_n] =
	\max_{j_1 = s_1 i_1, \dots, j_n = s_n i_n}^{j_1 = s_1 i_1 + w_1 - 1, \dots, j_n = s_n i_n + w_n - 1} (T_{in}[a,c,j_1,\dots,j_n])


C++ Interface
=============

.. doxygenclass:: ngraph::op::MaxPool
   :project: ngraph
   :members: