MCPcopy
hub / github.com/THUDM/CogDL / row_normalization

Function row_normalization

cogdl/utils/graph_utils.py:72–79  ·  view source on GitHub ↗
(num_nodes, row, col, val=None)

Source from the content-addressed store, hash-verified

70
71
72def row_normalization(num_nodes, row, col, val=None):
73 device = row.device
74 if val is None:
75 val = torch.ones(row.shape[0], device=device)
76 row_sum = get_degrees(row, col, num_nodes)
77 row_sum_inv = row_sum.pow(-1).view(-1)
78 row_sum_inv[torch.isinf(row_sum_inv)] = 0
79 return val * row_sum_inv[row]
80
81
82def symmetric_normalization(num_nodes, row, col, val=None):

Callers 5

dropout_adjFunction · 0.90
normalize_adjMethod · 0.90
bdd_forwardMethod · 0.90
forwardMethod · 0.90

Calls 1

get_degreesFunction · 0.85

Tested by

no test coverage detected