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

Method __init__

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

Source from the content-addressed store, hash-verified

1018class SelfReg(ERM):
1019
1020 def __init__(self, input_shape, num_classes, num_domains, hparams):
1021 super(SelfReg, self).__init__(input_shape, num_classes, num_domains, hparams)
1022 self.num_classes = num_classes
1023 self.MSEloss = nn.MSELoss()
1024 input_feat_size = self.featurizer.n_outputs
1025 hidden_size = input_feat_size if input_feat_size == 2048 else input_feat_size * 2
1026
1027 self.cdpl = nn.Sequential(
1028 nn.Linear(input_feat_size, hidden_size), nn.BatchNorm1d(hidden_size),
1029 nn.ReLU(inplace=True), nn.Linear(hidden_size, hidden_size), nn.BatchNorm1d(hidden_size),
1030 nn.ReLU(inplace=True), nn.Linear(hidden_size, input_feat_size),
1031 nn.BatchNorm1d(input_feat_size)
1032 )
1033
1034 def update(self, minibatches, unlabeled=None):
1035

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected