Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
rusty1s committed Mar 21, 2022
1 parent c910e96 commit 9026ebc
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions torch_geometric/nn/conv/pna_conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,12 @@ def __init__(self, in_channels: int, out_channels: int,
self.F_out = self.out_channels // towers

deg = deg.to(torch.float)
total_no_vertices = deg.sum()
bin_degrees = torch.arange(len(deg))
num_nodes = int(deg.sum())
bin_degrees = torch.arange(deg.numel())
self.avg_deg: Dict[str, float] = {
'lin': ((bin_degrees * deg).sum() / total_no_vertices).item(),
'log':
(((bin_degrees + 1).log() * deg).sum() / total_no_vertices).item(),
'exp':
((bin_degrees.exp() * deg).sum() / total_no_vertices).item(),
'lin': float((bin_degrees * deg).sum()) / num_nodes,
'log': float(((bin_degrees + 1).log() * deg).sum()) / num_nodes,
'exp': float((bin_degrees.exp() * deg).sum()) / num_nodes,
}

if self.edge_dim is not None:
Expand Down

0 comments on commit 9026ebc

Please sign in to comment.