hard_sigmoid¶
Piecewise-linear approximation of sigmoid:
\[\text{HardSigmoid}(x) = \frac{\min(\max(x + 3,\ 0),\ 6)}{6}\]
ATen source: aten.hardsigmoid
Inputs¶
Name |
Description |
|---|---|
|
Tensor of any rank |
Attributes¶
Name |
Type |
Description |
|---|---|---|
|
|
Composite op version |
Output¶
Name |
Shape |
Description |
|---|---|---|
|
same as |
Same shape and dtype as |
Data types¶
fp16, fp32, bf16.
PyTorch example¶
import torch
input = torch.rand(1, 3, 64, 64)
output = torch.nn.functional.hardsigmoid(input)