bitorch.layers.pact.Pact

class bitorch.layers.pact.Pact(bits: Optional[int] = None)[source]

Pact activation function taken from https://github.com/KwangHoonAn/PACT. Initially proposed in Choi, Jungwook, et al. “Pact: Parameterized clipping activation for quantized neural networks.” (2018)

Methods

__init__

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward

Defines the computation performed at every call.

Attributes

__init__(bits: Optional[int] = None) None[source]

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward(x: Tensor) 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.