domain
DomainLossHook
¶
Bases: BaseWrapperHook
Computes the loss of a discriminator's output with respect to domain labels.
Source code in pytorch_adapt\hooks\domain.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|
__init__(d_loss_fn=None, detach_features=False, reverse_labels=False, domains=None, f_hook=None, d_hook=None, **kwargs)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
d_loss_fn |
The loss applied to the discriminator's logits.
If |
None
|
|
detach_features |
If |
False
|
|
reverse_labels |
If |
False
|
|
domains |
The domains to apply the loss to.
If |
None
|
|
f_hook |
The hook for computing the input to the discriminator. |
None
|
|
d_hook |
The hook for computing the discriminator logits. |
None
|
Source code in pytorch_adapt\hooks\domain.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
|
FeaturesForDomainLossHook
¶
Bases: FeaturesChainHook
A FeaturesChainHook
that has options specific to
DomainLossHook
.
Source code in pytorch_adapt\hooks\domain.py
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 36 37 38 39 40 41 42 43 44 45 46 |
|
__init__(f_hook=None, l_hook=None, use_logits=False, domains=None, detach=False, **kwargs)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
f_hook |
hook for computing features |
None
|
|
l_hook |
hook for computing logits. This will be used
only if |
None
|
|
use_logits |
If |
False
|
|
domains |
the domains for which features will be computed. |
None
|
|
detach |
If |
False
|
Source code in pytorch_adapt\hooks\domain.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|