捷徑

ReLU6

class torch.ao.nn.quantized.ReLU6(inplace=False)[來源][來源]

套用逐元素函數

ReLU6(x)=min(max(x0,x),q(6))\text{ReLU6}(x) = \min(\max(x_0, x), q(6)), 其中 x0x_0 是 zero_point,而 q(6)q(6) 是數字 6 的量化表示。

參數

inplace (bool) – 是否選擇性地就地執行運算。預設值:False

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

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

../_images/ReLU6.png

範例

>>> m = nn.quantized.ReLU6()
>>> input = torch.randn(2)
>>> input = torch.quantize_per_tensor(input, 1.0, 0, dtype=torch.qint32)
>>> output = m(input)

文件

取得 PyTorch 的完整開發者文件

檢視文件

教學課程

取得針對初學者和進階開發者的深入教學課程

檢視教學課程

資源

尋找開發資源並取得您問題的解答

檢視資源