捷徑

Hardsigmoid

class torch.nn.Hardsigmoid(inplace=False)[原始碼][原始碼]

以元素方式套用 Hardsigmoid 函數。

Hardsigmoid 定義為

Hardsigmoid(x)={0if x3,1if x+3,x/6+1/2otherwise\text{Hardsigmoid}(x) = \begin{cases} 0 & \text{if~} x \le -3, \\ 1 & \text{if~} x \ge +3, \\ x / 6 + 1 / 2 & \text{otherwise} \end{cases}
參數

inplace (bool) – 可以選擇是否原地 (in-place) 執行此運算。預設值:False

形狀
  • 輸入:()(*),其中 * 代表任意數量的維度。

  • 輸出:()(*),與輸入的形狀相同。

../_images/Hardsigmoid.png

範例

>>> m = nn.Hardsigmoid()
>>> input = torch.randn(2)
>>> output = m(input)

文件

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources