Commit e571009d authored by Scott Cyphers's avatar Scott Cyphers Committed by Robert Kimball

Doc for slice (#1872)

parent 3ea3c0c3
......@@ -101,6 +101,7 @@ Not currently a comprehensive list.
* :doc:`sign`
* :doc:`sin`
* :doc:`sinh`
* :doc:`slice`
* :doc:`softmax`
* :doc:`sqrt`
* :doc:`subtract`
......@@ -166,6 +167,7 @@ Not currently a comprehensive list.
sign.rst
sin.rst
sinh.rst
slice.rst
softmax.rst
sqrt.rst
subtract.rst
......
.. slice.rst:
#####
Slice
#####
.. code-block:: cpp
Slice // Produces a sub-tensor of its input.
Description
===========
Takes a slice of an input tensor, i.e., the sub-tensor that
resides within a bounding box, optionally with a stride.
Inputs
------
+-----------------+-------------------------+----------------------------------+
| Name | Element Type | Shape |
+=================+=========================+==================================+
| `arg` | Any | :math:`D=D_1, D_2, \ldots, D_n`. |
+-----------------+-------------------------+----------------------------------+
Attributes
----------
+-------------------------------+-----------------------------------------------+
| Name | Description |
+===============================+===============================================+
| `lower_bounds` | The (inclusive) lower-bound coordinates |
| | :math:`L=L_1, L_2, \ldots, L_n.` |
+-------------------------------+-----------------------------------------------+
| `upper_bounds` | The (exclusive) upper-bound coordinates |
| | :math:`U=U_1, U_2, \ldots, U_n.` |
+-------------------------------+-----------------------------------------------+
| `strides` | The strides :math:`S=S_1, S_2, \ldots, S_n` |
| | for the slices. Defaults to 1s. |
+-------------------------------+-----------------------------------------------+
Outputs
-------
+-----------------+-------------------------+-----------------------------------------------+
| Name | Element Type | Shape |
+=================+=========================+===============================================+
| ``output`` | Same as `arg` | :math:`D'_i=\lceil\frac{U_i-L_i}{S_i}\rceil`. |
+-----------------+-------------------------+-----------------------------------------------+
Mathematical Definition
=======================
.. math::
\mathtt{output}_I = \mathtt{arg}_{L+I*S}
where :math:`I=I_1, I_2, \ldots, I_n` is a coordinate of the output.
C++ Interface
=============
.. doxygenclass:: ngraph::op::Slice
:project: ngraph
:members:
......@@ -25,31 +25,6 @@ namespace ngraph
namespace op
{
/// \brief Takes a slice of an input tensor, i.e., the sub-tensor that resides within a bounding box, optionally with stride.
///
/// Given an input tensor \f$T\f$ of shape \f$[d_1,\dots,d_n]\f$, lower bounds \f$[l_1,\dots,l_n]\f$, and upper bounds \f$[u_1,\dots,u_n]\f$,
/// where \f$l_i \leq d_i \leq d_i\f$, and a stride \f$[s_1,\dots,s_n]\f$, returns a new tensor \f$T'\f$ of the same element type and shape
/// \f$[d'_1,\dots,d'_n]\f$ where \f$d'_i = \lceil(u_i - l_i)\, /\, s_i\rceil\f$, where \f$T'[i_1,\dots,i_n] = T[i'_1,\dots,i'_n]\f$
/// where \f$i'_j = i_j s_j + l_j\f$.
///
/// ## Parameters
///
/// | | Description |
/// | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
/// | `lower_bounds` | The (inclusive) lower-bound coordinates \f$l_i\f$ for the tensor slice. For example, a lower-bound of \f$(1,2)\f$ means to start the slice at row 1 and column 2. |
/// | `upper_bounds` | The (non-inclusive) upper-bound coordinates \f$u_i\f$ for the tensor slice. For example, an upper-bound of \f$(5,4)\f$ means to end the slice before row 4 and column 3. |
/// | `strides` | The strides \f$s_i\f$ for the tensor slice. For example, in the matrix case, strides of \f$(1,3)\f$ means to take every row, and every third column (starting at the lower bound). |
///
/// ## Inputs
///
/// | | Type | Description |
/// | ----- | --------------------------------------------------- | --------------------------------------- |
/// | `arg` | \f$E[\mathit{del}([d_1,\dots,d_n],A)]~(n \geq 0)\f$ | A tensor of any shape and element type. |
///
/// ## Output
///
/// | Type | Description |
/// | ------------------------------------------------------------------------------ | --------------------------------- |
/// | \f$E[d'_1,\dots,d'_n]\f$ where \f$d'_i = \lceil(u_i - l_i)\, /\, s_i\rceil\f$. | The tensor sliced from the input. |
class Slice : public Op
{
public:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment