MCPcopy Create free account
hub / github.com/alexrame/fishr / __init__

Method __init__

domainbed/algorithms.py:687–702  ·  view source on GitHub ↗
(self, input_shape, num_classes, num_domains, hparams)

Source from the content-addressed store, hash-verified

685 """
686
687 def __init__(self, input_shape, num_classes, num_domains, hparams):
688 super(MTL, self).__init__(input_shape, num_classes, num_domains, hparams)
689 self.featurizer = networks.Featurizer(input_shape, self.hparams)
690 self.classifier = networks.Classifier(
691 self.featurizer.n_outputs * 2, num_classes, self.hparams['nonlinear_classifier']
692 )
693 self.optimizer = torch.optim.Adam(
694 list(self.featurizer.parameters()) +\
695 list(self.classifier.parameters()),
696 lr=self.hparams["lr"],
697 weight_decay=self.hparams['weight_decay']
698 )
699
700 self.register_buffer('embeddings', torch.zeros(num_domains, self.featurizer.n_outputs))
701
702 self.ema = self.hparams['mtl_ema']
703
704 def update(self, minibatches, unlabeled=None):
705 loss = 0

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected