Shortcuts

HSigmoid

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

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)

Note

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

Parameters:
  • 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.

Returns:

The output tensor.

Return type:

Tensor

forward(x: Tensor) Tensor[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

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.