Sigmoid revise (#2942)
* remove sigmoid_backprop * Update Sigmoid spec * Update Sigmoid spec
This commit is contained in:
parent
a66c728a46
commit
c8bd92ac0d
@ -6,7 +6,17 @@
|
|||||||
|
|
||||||
**Short description**: Sigmoid element-wise activation function.
|
**Short description**: Sigmoid element-wise activation function.
|
||||||
|
|
||||||
**Attributes**: operations has no attributes.
|
**Detailed description**: [Reference](https://deepai.org/machine-learning-glossary-and-terms/sigmoid-function)
|
||||||
|
|
||||||
|
**Attributes**: *Sigmoid* operation has no attributes.
|
||||||
|
|
||||||
|
**Mathematical Formulation**
|
||||||
|
|
||||||
|
For each element from the input tensor calculates corresponding
|
||||||
|
element in the output tensor with the following formula:
|
||||||
|
\f[
|
||||||
|
sigmoid( x ) = \frac{1}{1+e^{-x}}
|
||||||
|
\f]
|
||||||
|
|
||||||
**Inputs**:
|
**Inputs**:
|
||||||
|
|
||||||
@ -16,10 +26,22 @@
|
|||||||
|
|
||||||
* **1**: Result of Sigmoid function applied to the input tensor *x*. Floating point tensor with shape and type matching the input tensor. Required.
|
* **1**: Result of Sigmoid function applied to the input tensor *x*. Floating point tensor with shape and type matching the input tensor. Required.
|
||||||
|
|
||||||
**Mathematical Formulation**
|
**Example**
|
||||||
|
|
||||||
For each element from the input tensor calculates corresponding
|
```xml
|
||||||
element in the output tensor with the following formula:
|
<layer ... type="Sigmoid">
|
||||||
\f[
|
<input>
|
||||||
sigmoid( x ) = \frac{1}{1+e^{-x}}
|
<port id="0">
|
||||||
\f]
|
<dim>256</dim>
|
||||||
|
<dim>56</dim>
|
||||||
|
</port>
|
||||||
|
</input>
|
||||||
|
<output>
|
||||||
|
<port id="1">
|
||||||
|
<dim>256</dim>
|
||||||
|
<dim>56</dim>
|
||||||
|
</port>
|
||||||
|
</output>
|
||||||
|
</layer>
|
||||||
|
|
||||||
|
```
|
@ -35,19 +35,6 @@ namespace ngraph
|
|||||||
out[i] = 1 / (1 + exp_value);
|
out[i] = 1 / (1 + exp_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void sigmoid_backprop(const T* arg, const T* delta_arg, T* out, size_t count)
|
|
||||||
{
|
|
||||||
T exp_value;
|
|
||||||
T func_x;
|
|
||||||
for (size_t i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
exp_value = std::exp(-arg[i]);
|
|
||||||
func_x = 1 / (1 + exp_value);
|
|
||||||
out[i] = delta_arg[i] * func_x * (1 - func_x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user