Commit 2aa7899c authored by Scott Cyphers's avatar Scott Cyphers Committed by Robert Kimball

Sigmoid and tanh doc, edit for abs (#1704)

* Sigmoid and tanh  doc, edit for abs

* Add equation for sigmoid.
parent f81917b1
...@@ -8,6 +8,15 @@ Sigmoid ...@@ -8,6 +8,15 @@ Sigmoid
Sigmoid // Elementwise sigmoid operation Sigmoid // Elementwise sigmoid operation
Description
===========
Produces a single output tensor of the same element type and shape as
``arg,`` where the value at each coordinate of ``output`` is the
sigmoid of ``arg`` at the same coordinate.
Inputs Inputs
------ ------
...@@ -31,11 +40,9 @@ Mathematical Definition ...@@ -31,11 +40,9 @@ Mathematical Definition
.. math:: .. math::
\mathtt{output}_{i_0, \ldots, i_{n-1}} = \mathtt{output}_{i_0, \ldots, i_{n-1}} = \frac{1}{1+\exp(-\mathtt{arg}_{i_0,
\begin{cases} \ldots, i_{n-1}})}
0&\text{if }\mathtt{arg}_{i_0, \ldots, i_{n-1}} \le 0 \\
\mathtt{arg}_{i_0, \ldots, i_{n-1}}&\text{otherwise}
\end{cases}
C++ Interface C++ Interface
============= =============
......
...@@ -8,22 +8,51 @@ Tanh ...@@ -8,22 +8,51 @@ Tanh
Tanh // Elementwise hyperbolic tangent operation. Tanh // Elementwise hyperbolic tangent operation.
.. /// \brief Elementwise hyperbolic tangent operation. Description
/// ===========
/// ## Inputs
///
/// | | Type | Description |
/// | ----- | --------------------------------- | ----------------------------------------------- |
/// | `arg` | \f$N[d_1,\dots,d_n]~(n \geq 0)\f$ | A tensor of any shape and numeric element type. |
///
/// ## Output
///
/// | Type | Description |
/// | ---------------------- | ------------------------------------------------------------------------------------- |
/// | \f$N[d_1,\dots,d_n]\f$ | The tensor \f$T\f$, where \f$T[i_1,\dots,i_n] = \tanh(\texttt{arg}[i_1,\dots,i_n])\f$ |
.. /// \brief Constructs a hyperbolic tangent operation.
///
/// \param arg Node that produces the input tensor.
Produce a tensor with the same shape and element typye as ``arg,``
where the value at each coordinate of ``output`` is the hyperbolic
tangent of the value of ``arg`` at the same coordinate.
Inputs
------
+-----------------+-------------------------+--------------------------------+
| Name | Element Type | Shape |
+=================+=========================+================================+
| ``arg`` | Any | Any |
+-----------------+-------------------------+--------------------------------+
Outputs
-------
+-----------------+-------------------------+--------------------------------+
| Name | Element Type | Shape |
+=================+=========================+================================+
| ``output`` | Same as ``arg`` | Same as ``arg`` |
+-----------------+-------------------------+--------------------------------+
Mathematical Definition
=======================
.. math::
\mathtt{output}_{i_0, \ldots, i_{n-1}} = \tanh(\mathtt{arg}_{i_0,
\ldots, i_{n-1}})
Backprop
========
.. math::
\overline{\mathtt{arg}} \leftarrow \Delta\ (1 - \texttt{output}^2)
C++ Interface
=============
.. doxygenclass:: ngraph::op::Tanh
:project: ngraph
:members:
...@@ -23,18 +23,6 @@ namespace ngraph ...@@ -23,18 +23,6 @@ namespace ngraph
namespace op namespace op
{ {
/// \brief Elementwise hyperbolic tangent operation. /// \brief Elementwise hyperbolic tangent operation.
///
/// ## Inputs
///
/// | | Type | Description |
/// | ----- | --------------------------------- | ----------------------------------------------- |
/// | `arg` | \f$N[d_1,\dots,d_n]~(n \geq 0)\f$ | A tensor of any shape and numeric element type. |
///
/// ## Output
///
/// | Type | Description |
/// | ---------------------- | ------------------------------------------------------------------------------------- |
/// | \f$N[d_1,\dots,d_n]\f$ | The tensor \f$T\f$, where \f$T[i_1,\dots,i_n] = \tanh(\texttt{arg}[i_1,\dots,i_n])\f$ |
class Tanh : public util::UnaryElementwiseArithmetic class Tanh : public util::UnaryElementwiseArithmetic
{ {
public: 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