salad packageΒΆ
Test salad is a toolbox for semi-supervised adaptive learning across domains. It is mainly meant for domain adaptation, semi-supervised learning and transfer learning in general, using PyTorch as a backend.
$$ mathbb{E}_{p_t} [ mathcal{L}(x_t, y_t) ] $$
SubpackagesΒΆ
- salad.datasets package
- salad.layers package
- salad.models package
- salad.solver package
- Submodules
- salad.solver.base module
- salad.solver.da.base module
- salad.solver.da.advdrop module
- salad.solver.da.association module
- salad.solver.da.coral module
- salad.solver.da.crossgrad module
- salad.solver.da.dann module
- salad.solver.da.dirtt module
- salad.solver.da.dirtt_re module
- salad.solver.da.djdot module
- salad.solver.da.ensembling module
- salad.solver.classification module
- salad.solver.gan module
- salad.solver.openset module
- salad.utils package
SubmodulesΒΆ
salad.optim moduleΒΆ
-
class
salad.optim.
JointOptimizer
(*optims)ΒΆ Bases:
object
Concat multiple optimizers
Parameters: *optims (list of torch.optim.Optimizer
) β Optimizers. Thestep
andzero_grad
functions will be executed in the same order.-
step
()ΒΆ
-
zero_grad
()ΒΆ
-
-
class
salad.optim.
WeightEMA
(params, src_params, alpha=0.999)ΒΆ Bases:
object
Exponential moving average weight optimizer for mean teacher model
Used for Self-Ensembling, code adapted from [1].
See also
salad.solver.SelfEnsemblingSolver
[1] https://github.com/Britefury/self-ensemble-visual-domain-adapt -
step
()ΒΆ
-
zero_grad
()ΒΆ
-
salad.structural moduleΒΆ
Helper functions for structural learning
-
class
salad.structural.
CompressedResnet
(backbone)ΒΆ Bases:
torch.nn.modules.module.Module
ResNet Variant where the batch norm statistics are merged into the transformation matrices
-
forward
(x)ΒΆ 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.
-
-
class
salad.structural.
FixedBottleneck
(conv, downsample)ΒΆ Bases:
torch.nn.modules.module.Module
-
forward
(x)ΒΆ 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.
-
-
salad.structural.
FixedResnet
(backbone)ΒΆ ResNet Variant where each batch norm layer is replaced by a linear transformation
-
salad.structural.
bn2linear
(bn)ΒΆ
-
salad.structural.
convert_conv_bn
(layer, bn)ΒΆ
-
salad.structural.
get_affine
(layer)ΒΆ
-
salad.structural.
reinit_bns
(module)ΒΆ
-
salad.structural.
replace_bns
(module)ΒΆ