Shortcuts

HSwish

class mmcv.cnn.HSwish(inplace: bool = False)[source]

Hard Swish Module.

This module applies the hard swish function:

\[Hswish(x) = x * ReLU6(x + 3) / 6\]
Parameters

inplace (bool) – can optionally do the operation in-place. Default: False.

Returns

The output tensor.

Return type

Tensor

forward(x: torch.Tensor)torch.Tensor[source]

Defines 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.