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

Method forward

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

Source from the content-addressed store, hash-verified

382 nn.init.constant_(m.bias, 0)
383
384 def forward(self, x):
385 probability = []
386 if self.shared_projected_layer is None:
387 attribute_embedding = []
388 for classifier in self.classifier_list:
389 projected = classifier[0](x)
390 _attribute_embedding = classifier[1](projected)
391 attribute_embedding.append(_attribute_embedding.detach().clone())
392 activate = classifier[2](_attribute_embedding)
393 logit = classifier[3](activate)
394 probability.append(self._log_softmax(logit))
395 attribute_embedding = torch.cat(attribute_embedding, dim=1)
396 else:
397 attribute_embedding = self.shared_projected_layer(x)
398 for classifier in self.classifier_list:
399 logit = classifier(attribute_embedding)
400 probability.append(self._log_softmax(logit))
401 if self.training == True:
402 return probability
403 else:
404 return attribute_embedding
405
406
407

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected