gradient_reversal
GradientReversal
¶
Bases: torch.nn.Module
Implementation of the gradient reversal layer described in Domain-Adversarial Training of Neural Networks, which 'leaves the input unchanged during forward propagation and reverses the gradient by multiplying it by a negative scalar during backpropagation.'
Source code in pytorch_adapt\layers\gradient_reversal.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
__init__(weight=1.0)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
weight |
float
|
The gradients will be multiplied by |
1.0
|
Source code in pytorch_adapt\layers\gradient_reversal.py
16 17 18 19 20 21 22 23 24 |
|