bitorch.layers.qactivation.GradientCancellation¶
- class bitorch.layers.qactivation.GradientCancellation(*args, **kwargs)[source]¶
Methods
Apply straight through estimator.
Binarize input tensor using the _sign function.
Attributes
- static backward(ctx: BackwardCFunction, output_grad: Tensor) Tuple[Tensor, None] [source]¶
Apply straight through estimator.
This passes the output gradient towards the input if the inputs are in the range [-1, 1].
- Parameters:
ctx (gradient context) – context
output_grad (toch.Tensor) – the tensor containing the output gradient
- Returns:
the input gradient (= the masked output gradient)
- Return type:
torch.Tensor