Shortcuts

HSigmoid

class mmcv.cnn.HSigmoid(bias: float = 3.0, divisor: float = 6.0, min_value: float = 0.0, max_value: float = 1.0)[源代码]

Hard Sigmoid Module. Apply the hard sigmoid function: Hsigmoid(x) = min(max((x + bias) / divisor, min_value), max_value) Default: Hsigmoid(x) = min(max((x + 3) / 6, 0), 1)

注解

In MMCV v1.4.4, we modified the default value of args to align with PyTorch official.

参数
  • bias (float) – Bias of the input feature map. Default: 3.0.

  • divisor (float) – Divisor of the input feature map. Default: 6.0.

  • min_value (float) – Lower bound value. Default: 0.0.

  • max_value (float) – Upper bound value. Default: 1.0.

返回

The output tensor.

返回类型

Tensor

forward(x: torch.Tensor)torch.Tensor[源代码]

Defines the computation performed at every call.

Should be overridden by all subclasses.

注解

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.