Skip to content

Commit

Permalink
Add SoftPlus to Hybrid head
Browse files Browse the repository at this point in the history
  • Loading branch information
baskrahmer committed Apr 29, 2024
1 parent 2315ac4 commit 3b4c043
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ def __init__(self, hidden_dim: int, num_classes: int, alpha: float):
self.regression_linear = nn.Linear(in_features=num_classes, out_features=1)
self.regression_loss = nn.MSELoss()
self.classification_loss = nn.CrossEntropyLoss()
self.activation = nn.Softplus()
self.alpha = alpha

def __call__(self, activations, classes, regressands, **kwargs) -> dict:
logits = self.classification_linear(activations)
classification_loss = self.classification_loss(logits, classes)
predicted_values = self.regression_linear(logits)
predicted_values = self.activation(self.regression_linear(logits))
regression_loss = self.regression_loss(predicted_values, regressands)
return {
"predicted_values": predicted_values,
Expand Down

0 comments on commit 3b4c043

Please sign in to comment.