sakura.utils.gradient_reverse.ReverseLayerF
- class sakura.utils.gradient_reverse.ReverseLayerF(*args, **kwargs)
Bases:
FunctionCustom autograd class that reverses and scales gradients during backward pass
- During forward:
Acts as identity operation (returns input unchanged)
- During backward:
Reverses gradient direction by multiplying with negative alpha;
Scales gradients by alpha coefficient
Methods
Backward pass for the custom autograd operation with gradient scaling.
Forward pass for a custom autograd operation with gradient scaling.
Attributes