<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="torch.nn.Hardshrink()(torch.rand(10).to('cuda:0'))"><pre class="notranslate"><span class="pl-s1">torch</span>.<span class="pl-s1">nn</span>.<span class="pl-v">Hardshrink</span>()(<span class="pl-s1">torch</span>.<span class="pl-en">rand</span>(<span class="pl-c1">10</span>).<span class="pl-en">to</span>(<span class="pl-s">'cuda:0'</span>))</pre></div>
<p dir="auto">Request from <a href="https://discuss.pytorch.org/t/hardshrink-doesnt-support-cuda-floattensor/11088" rel="nofollow">https://discuss.pytorch.org/t/hardshrink-doesnt-support-cuda-floattensor/11088</a>.</p>