<p>The hard tanh function is sometimes preferred over the tanh function since it is computationally cheaper. It does however saturate for magnitudes of x greater than 1. The activation of the hard tanh is:</p>

<pre><code>f(x) = max, if x &gt; max,
f(x) = min, if x &lt; min,
f(x) = x, otherwise.
</code></pre>

<p>It would be great, if mlpack would provide  an implementation of a <code>HardTanHLayer</code> that allows the specification of the min and max value.</p>

<pre><code>HardTanHLayer(const double minValue = -1, const double maxValue = 1)
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/issues/540">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFM_-_tBmiJSoAke8E1PunU9DCZX_ks5ppaEegaJpZM4HnfY2.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/mlpack/mlpack/issues/540"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>