microsoft / Graphormer

Graphormer is a general-purpose deep learning backbone for molecular modeling.
MIT License
2.08k stars 334 forks source link

question about edge feature encoding #115

Closed YJiangcm closed 2 years ago

YJiangcm commented 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_)
mavisguan commented 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!)

YJiangcm commented 2 years ago

Thanks for you answering : )