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

Method forward

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

Source from the content-addressed store, hash-verified

723 nn.init.constant_(m.bias, 0)
724
725 def forward(self, x):
726 probability = []
727 if self.shared_projected_layer is None:
728 attribute_embedding = []
729 for classifier in self.classifier_list:
730 projected = classifier[0](x)
731 bn_projected = classifier[1](projected)
732 attribute_embedding.append(bn_projected.detach().clone())
733 activate = classifier[2](bn_projected)
734 logit = classifier[3](activate)
735 # attribute_embedding.append(logit.detach().clone())
736 probability.append(self._log_softmax(logit))
737 attribute_embedding = torch.cat(attribute_embedding, dim=1)
738 else:
739 attribute_embedding = self.shared_projected_layer(x)
740 for classifier in self.classifier_list:
741 logit = classifier(attribute_embedding)
742 probability.append(self._log_softmax(logit))
743 if self.training == True:
744 return probability
745 else:
746 return attribute_embedding
747
748
749class Attribute_Classifier6ind(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected