fix models
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
from torch_geometric.nn import MessagePassing
|
||||
from tqdm import tqdm
|
||||
|
||||
|
||||
class FiniteDifferenceStep(MessagePassing):
|
||||
@@ -14,8 +13,9 @@ class FiniteDifferenceStep(MessagePassing):
|
||||
assert (
|
||||
aggr == "add"
|
||||
), "Per somme pesate, l'aggregazione deve essere 'add'."
|
||||
self.root_weight = float(root_weight)
|
||||
self.p = torch.nn.Parameter(torch.tensor(0.5))
|
||||
# self.root_weight = float(root_weight)
|
||||
self.p = torch.nn.Parameter(torch.tensor(0.8))
|
||||
self.a = root_weight
|
||||
|
||||
def forward(self, x, edge_index, edge_attr, deg):
|
||||
"""
|
||||
@@ -43,7 +43,9 @@ class FiniteDifferenceStep(MessagePassing):
|
||||
"""
|
||||
TODO: add docstring.
|
||||
"""
|
||||
return self.root_weight * aggr_out + (1 - self.root_weight) * x
|
||||
a = torch.clamp(self.a, 0.0, 1.0)
|
||||
return a * aggr_out + (1 - a) * x
|
||||
# return self.a * aggr_out + (1 - self.a) * x
|
||||
|
||||
|
||||
class GraphFiniteDifference(nn.Module):
|
||||
|
||||
Reference in New Issue
Block a user