MCPcopy Create free account
hub / github.com/TPCD/DCCL / forward

Method forward

model/vision_transformer.py:524–544  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

522 nn.init.constant_(m.bias, 0)
523
524 def forward(self, x):
525 probability = []
526 if self.shared_projected_layer is None:
527 attribute_embedding = []
528 for classifier in self.classifier_list:
529 projected = classifier[0](x)
530 _attribute_embedding = classifier[1](projected)
531 attribute_embedding.append(_attribute_embedding.detach().clone())
532 activate = classifier[2](_attribute_embedding)
533 logit = classifier[3](activate)
534 probability.append(self._log_softmax(logit))
535 attribute_embedding = torch.cat(attribute_embedding, dim=1)
536 else:
537 attribute_embedding = self.shared_projected_layer(x)
538 for classifier in self.classifier_list:
539 logit = classifier(attribute_embedding)
540 probability.append(self._log_softmax(logit))
541 if self.training == True:
542 return probability
543 else:
544 return attribute_embedding
545
546
547class Attribute_BN_Classifier(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected