Closed YJiangcm closed 2 years ago
I notice that in graphormer/modules/graphormer_layers.py you modify the spatialpos by setting 1 to 1, x > 1 to x - 1, could you please tell me the reason?
if self.edge_type == "multi_hop": spatial_pos_ = spatial_pos.clone() spatial_pos_[spatial_pos_ == 0] = 1 # set pad to 1 # set 1 to 1, x > 1 to x - 1 spatial_pos_ = torch.where(spatial_pos_ > 1, spatial_pos_ - 1, spatial_pos_)
Hi, sorry for the late response. (Other team members have been just too busy to answer!)
pad_spatial_pos_unsqueeze()
in collator.py because we increment each element in spatial_pos by 1, and add zero padding. So later we set x > 1 to x - 1 to restore spatial_pos
to real shortest distance between nodes.edge_input = (
edge_input.sum(-2) / (spatial_pos_.float().unsqueeze(-1))
).permute(0, 3, 1, 2)
Thanks for you answering : )
I notice that in graphormer/modules/graphormer_layers.py you modify the spatialpos by setting 1 to 1, x > 1 to x - 1, could you please tell me the reason?