Skip to content

Commit

Permalink
make resnet and mlp responsible to ensure embeddings are correct dims
Browse files Browse the repository at this point in the history
  • Loading branch information
egillax committed Nov 25, 2024
1 parent ed51ca5 commit 62bd2ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions inst/python/MultiLayerPerceptron.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def __init__(
def forward(self, input):
x_cat = input["cat"]
x_cat = self.embedding(x_cat)
if x_cat.dim() == 3:
x_cat = x_cat.mean(dim=1)
if "num" in input.keys() and self.num_embedding is not None:
x_num = input["num"]
x = (x_cat + self.num_embedding(x_num).mean(dim=1)) / 2
Expand Down
2 changes: 2 additions & 0 deletions inst/python/ResNet.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def __init__(
def forward(self, x):
x_cat = x["cat"]
x_cat = self.embedding(x_cat)
if x_cat.dim() == 3:
x_cat = x_cat.mean(dim=1)
if (
"num" in x.keys()
and x["num"] is not None
Expand Down

0 comments on commit 62bd2ba

Please sign in to comment.