Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
zechengz committed Sep 30, 2024
1 parent d304462 commit 5e92a13
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions examples/ngcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ def reset_parameters(self):

def sparse_dropout(self, row: Tensor, col: Tensor, value: Tensor,
rate: float, nnz: int) -> SparseTensor:
rand = 1 - rate
rand += torch.rand(nnz)
rand: Tensor = (1 - rate) + torch.rand(nnz)
assert isinstance(rand, Tensor)
dropout_mask = torch.floor(rand).type(torch.bool)
adj = SparseTensor(
Expand Down Expand Up @@ -131,8 +130,8 @@ def get_embedding(self, norm_adj: SparseTensor,
ego_emb = F.dropout(ego_emb)
norm_emb = F.normalize(ego_emb, p=2, dim=1)
all_embs += [norm_emb]
all_embs: Tensor = torch.cat(all_embs, 1)
return all_embs
res_embs: Tensor = torch.cat(all_embs, 1)
return res_embs

def recommendation_loss(
self,
Expand Down

0 comments on commit 5e92a13

Please sign in to comment.